DekGenius.com
[ Team LiB ] Previous Section Next Section

ScrollableControlmarshal by reference, disposable

System.Windows.Forms (system.windows.forms.dll)class

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 virtual bool AutoScroll{set; get; }
   public Size AutoScrollMargin{set; get; }
   public Size AutoScrollMinSize{set; get; }
   public Point AutoScrollPosition{set; get; }
   public override Rectangle DisplayRectangle{get; }
// overrides Control
   public DockPaddingEdges DockPadding{get; }
// Protected Instance Properties
   protected override CreateParams CreateParams{get; }
// overrides Control
   protected bool HScroll{set; get; }
   protected bool VScroll{set; get; }
// Public Instance Methods
   public void ScrollControlIntoView(Control activeControl);
   public void SetAutoScrollMargin(int x, int y);
// Protected Instance Methods
   protected virtual void AdjustFormScrollbars(bool displayScrollbars);
   protected bool GetScrollState(int bit);
   protected override void OnLayout(LayoutEventArgs levent);  // overrides Control
   protected override void OnMouseWheel(MouseEventArgs e);  // overrides Control
   protected override void OnVisibleChanged(EventArgs e);  // overrides Control
   protected override void ScaleCore(float dx, float dy);  // overrides Control
   protected void SetDisplayRectLocation(int x, int y);
   protected void SetScrollState(int bit, bool value);
   protected override void WndProc(ref Message m);  // overrides Control
}

Hierarchy

System.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponen, System.IDisposable) Control(IOleContro, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, System.ComponentModel.ISynchronizeInvoke, IWin32Window) ScrollableControl

Subclasses

ContainerControl, Panel, System.Windows.Forms.Design.ComponentTray

    [ Team LiB ] Previous Section Next Section