Name
ScrollableControl
Synopsis
This is the base class for controls that support automatic scrolling.
This includes ContainerControl (and its subclasses
such as UserControl) and Panel.
To enable scrolling, you set the AutoScroll
property. You can then specify the
AutoScrollMinSize. If the control is made smaller
than the AutoScrollMinSize, scrollbars are
displayed. Alternatively, if any child controls are found within
AutoScrollMargin pixels of the edge of its visible
area, the scrollbars will also be shown.
You can set or retrieve the current
AutoScrollPosition. Note that when you retrieve
the position, it comes back as {-x,-y}, whereas when you set it, you
must specify {x,y}.
As the AutoScrollPosition is changed, the window
content is automatically blitted into the new position, child
controls are offset by the appropriate amount, and any newly revealed
parts of the control are invalidated for repaint. While this is the
most efficient repaint scheme, it is not necessarily ideal for all
applications. As an alternative, you can create and manage your own
ScrollBar controls.
public class ScrollableControl : Control { // Public Constructors public ScrollableControl(); // Protected Static Fields protected const int ScrollStateAutoScrolling; // =1 protected const int ScrollStateFullDrag; // =16 protected const int ScrollStateHScrollVisible; // =2 protected const int ScrollStateUserHasScrolled; // =8 protected const int ScrollStateVScrollVisible; // =4 // Public Instance Properties public ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access