The ScrollableControl class has 2 protected boolean properties: HScroll and VScroll.
As the document says:
Gets or sets a value indicating whether the horizontal scroll bar is visible.
And
AutoScroll maintains the visibility of the scrollbars automatically. Therefore, setting the HScroll or VScroll properties to true have no effect when AutoScroll is enabled.
So I use them like this, but the scrollbar isn't showed:
class MyScrollableControl : ScrollableControl {
public MyScrollableControl() {
this.AutoScroll = false;
this.HScroll = true;
}
}
If I use the following code, it works:
this.HorizontalScroll.Visible = true;
When I put them torgether, the scrollbar is still invisible, and the values of HScroll and HorizontalScroll.Visible keep False.
this.AutoScroll = false;
this.HScroll = true;
this.HorizontalScroll.Visible = true;
So what is the real use of HScroll and VScroll ?
Update
My code and test
HScroll
property does not affect scroll visibility directly, but it prevent Scroll to be hidden withHorizontalScroll.Visible
valueIn case when
HorizontalScroll.Visible
is set totrue
thanHScroll
will also get a valuetrue
(see 2nd line in the table)In case when
AutoScroll
is set to trueHorizontalScroll.Visible
always staystrue
andHScroll
doesnot have any influense (see last 2 lines)Make an app with Control that contains 3 buttons with next handler code, and play with it to see what exactly happening there:
Usage (AutoScroll =
false
)To Manually show Scroll set
HorizontalScroll.Visible
totrue
To Manually hide Scroll set
HScroll
tofalse
and thanHorizontalScroll.Visible
tofalse
Usage (AutoScroll =
true
)HorizontalScroll.Visible
is alwaystrue
and cannot be changedHScroll
doesnot affects anything