Class ScrollBar
A ScrollBar is a control that represents a horizontal or vertical scrollbar.
[ControlCategory("Common")]
public class ScrollBar : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
- Inheritance
-
ScrollBar
- Implements
- Derived
Remarks
A scrollbar has the following main attributes: range, thumb size, page size, and position. The range is the total number of units associated with the view represented by the scrollbar. For a table with 15 columns, the range would be 15. The thumb size is the number of units that are currently visible. For the table example, the window might be sized so that only 5 columns are currently visible, in which case the application would set the thumb size to 5. When the thumb size becomes the same as or greater than the range, the scrollbar will be automatically hidden on most platforms. The page size is the number of units that the scrollbar should scroll by, when 'paging' through the data. This value is normally the same as the thumb size length, because it is natural to assume that the visible window size defines a page. The scrollbar position is the current thumb position. Most applications will find it convenient to provide a function called AdjustScrollbars() which can be called initially, from an OnSize event handler, and whenever the application data changes in size. It will adjust the view, object and page size according to the size of the window and the size of the data.
Constructors
- ScrollBar()
Initializes a new instance of the ScrollBar class.
Properties
- AltPosInfo
Gets scrollbar position as ScrollBar.AltPositionInfo.
- BackgroundColor
Gets or sets the background color for the control.
- DefaultMetrics
Gets or sets default metrics used to paint non-system scrollbars.
- Font
Gets or sets the font of the text displayed by the control.
- ForegroundColor
Gets or sets the foreground color for the control.
- Handler
Gets control handler.
- IsBold
Gets or sets whether control's font is bold.
- IsVertical
Gets or sets whether ScrollBar is vertical.
- LargeChange
Gets or sets a value to be added to or subtracted from the Value property when the scroll box is moved a large distance.
- Maximum
Gets or sets the upper limit of values of the scrollable range.
- Metrics
Gets or sets metrics used to paint this scrollbar when its style is non-system.
- Minimum
Gets or sets the lower limit of values of the scrollable range.
- Padding
Gets or sets the padding inside a control.
- PosInfo
Gets scrollbar position as ScrollBarInfo.
- SmallChange
Gets or sets the value to be added to or subtracted from the Value property when the scroll thumb is moved a small distance.
- SystemTheme
Gets or sets which theme to use when System is used.
- Value
Gets or sets a numeric value that represents the current position of the scroll thumb on the scroll bar control.
Methods
- ArrowBitmapSizeFromMetrics()
Gets size of the arrow bitmap from the Metrics.
- BindHandlerEvents()
Binds events to the handler.
- CreateHandler()
Creates a handler for the control.
- GetRealMetrics()
Gets real scroll bar metrics. If Metrics is not specified, returns DefaultMetrics.
- LogInfo()
Logs scrollbar info.
- OnValueChanged(EventArgs)
Raises the ValueChanged event.
- RaiseScroll()
Raises scroll events.
- SetScrollbar(int?, int?, int?, bool)
Sets the native scrollbar properties.
- SizeFromMetrics()
Gets size of the scrollbar from the Metrics.
- ThumbSizeFromMetrics()
Gets size of the scroll thumb from the Metrics.
- ToString()
Returns a string that represents the ScrollBar control.
- UnbindHandlerEvents()
Unbinds events from the handler.
- UpdateScrollInfo()
Updates scroll info and calls SetScrollbar(int?, int?, int?, bool) to update native control.
Events
- IsVerticalChanged
Occurs when the IsVertical property is changed.
- ValueChanged
Occurs when the Value property is changed, either by a Scroll event or programmatically.