The ScrollLocation property represents the location of the visible portion of a the panel. Use this property to change the portion of the control that is displayed.
The System.Drawing.Point.X and System.Drawing.Point.Y coordinate values retrieved are negative if the control has scrolled away from its starting position (0,0). When you set this property, you must always assign positive System.Drawing.Point.X and System.Drawing.Point.Y values to set the scroll position relative to the starting position. For example, if you have a horizontal scroll bar and you set x and y to 200, you move the scroll 200 pixels to the right; if you then set x and y to 100, the scroll appears to jump the left by 100 pixels, because you are setting it 100 pixels away from the starting position. In the first case, ScrollLocation returns {-200, 0}; in the second case, it returns {-100,0}.
If the set value bigger than scrollable maximum value, the ScrollLocation will adjust the value to maximum value automatically. And also, if the set value smaller than scrollable minimum value, the ScrollLocation will adjust the value to minimum value automatically.
The following code example shows how to use this property.
This code example is part of a larger example provided for the ScrollIndicatorMode property.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2