I thought it was a very small problem, but it has never been used, so it is very inconvenient to use it now. I would like to write it down here and review the ScrollableControl class.
Sometimes, we need to display the scroll bar of the Form to display some space outside the Form. In most cases, we may use Panel, ContainerControl (Form) controls that can set the AutoScroll attribute.
The AutoScroll attribute is provided by the ScrollableControl class. In this class, all the settings that require the scroll bar are provided. The AutoScrollPosition attribute is of the Point type and the current scroll position of the scroll bar is set, according to the MSDN explanation:
AutoScrollPosition indicates the position of the scroll control display box. If the control starts to scroll away from its starting position (0, 0 ), And The coordinate value is negative. When setting this attribute, you must always specify a positive And Value to set the scroll position relative to the starting position. For example, if both x and y are set to 200, the scroll bar moves 200 pixels to the right. If both x and y are set to 100, the scroll bar moves 100 pixels to the left, because the 100 pixels are set to the distance from the start position. For the first setting, AutoScrollPosition returns {-200, 0}; for the second setting, it returns {-, 0 }.
Then, it is set to the lowest position of the vertical scroll bar:
This. VerticalScroll. Value = this. VerticalScroll. Maximum