Using ScrollBars in .Net

Is there any way to Use the Builtin ScrollBars that comes with each .Net ScrollableControl without setting the AutoScroll Property to Enable? Here is the issue, even If I Enable, set to Visible and declare min and max values as well as the smallChange and LargeChange for the HorizontalScrollBar and VerticalScrollBar they show up in the borders of the Control but they are useless. When clicked the thumb doesn't moves and the Scroll Event of the control doesn't bring any usefull information when scroll is clicked ( OldValue and NewValue are both 0) This is how I tried to set up the Scroll Bars Values:

        HorizontalScroll.Enabled = true;
        HorizontalScroll.Value = 80;
        HorizontalScroll.Minimum = 0;
        HorizontalScroll.Maximum = 300;
        HorizontalScroll.SmallChange = 2;
        HorizontalScroll.LargeChange = 4;
        HorizontalScroll.Visible = true;

(And did the same thing to the Vertical Scroll)

Any ideas? or do I have to add to new ScrollBars by myself to my control?


Well I couldn't find a way to reuse the same ScrollBars integrated with each Net Scrollable Control. Finally I made my own Scrolls and very Important ... override the AutoScroll Property if it is a Control someone else is going to reuse.

 public override bool AutoScroll
        {
            get { return false; }
            set
            {
                if (value)
                    throw new Exception("Auto Scroll not supported in this control");
                base.AutoScroll = false;
            }
        }
链接地址: http://www.djcxy.com/p/53692.html

上一篇: 如何重新加载注册表设置? (Symbol设备上的紧凑框架)

下一篇: 在.Net中使用ScrollBars