如何在Panel中配置System.Windows.Forms.VScrollBar? [英] How to configure System.Windows.Forms.VScrollBar in Panel?

查看:146
本文介绍了如何在Panel中配置System.Windows.Forms.VScrollBar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

我需要根据需要在Panel中自定义滚动条。所以我隐藏了Panel中的默认VerticalScroll并使用了System.Windows.Forms.VScrollBar。 

I need to customize the scrollbar in Panel, based on my need. So i am hiding default VerticalScroll in Panel and using System.Windows.Forms.VScrollBar. 

但我不知道如何配置Thumb高度,Panel中的每个VerticalScroll设置到  System.Windows.Forms.VScrollBar。 

But i don't know how to configure the Thumb height, every VerticalScroll settings in Panel to System.Windows.Forms.VScrollBar. 

屏幕截图

MSDN ALERTS

MSDN ALERTS

推荐答案

嗨Ravindran,

Hi Ravindran,

如果您想使用面板中的vScrollbar,你必须在面板中放置一个控件并使其高于面板。

If you want to use the vScrollbar in panel, you have to put a control in the panel and make it higher than the panel.

然后代码:

        private void Form5_Load(object sender, EventArgs e)
        {
            vScrollBar1.Maximum = pictureBox1.Height - panel1.Height;
        }

        private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            pictureBox1.Top = -vScrollBar1.Value;
        }

问候,

Frankie


这篇关于如何在Panel中配置System.Windows.Forms.VScrollBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆