ScrollableControlExtensions
Namespace: Wisej.Web.Markup
Assembly: Wisej.Framework (4.1.0.0)
Adds fluent markup extension methods to the ScrollableControl class.
- C#
- VB.NET
public class ScrollableControlExtensions
Public Class ScrollableControlExtensions
Methods
AutoScroll<TControl>(control, autoScroll)
Sets the AutoScroll property for the specified ScrollableControl, enabling or disabling automatic scrolling.
| Parameter | Type | Description |
|---|---|---|
| TControl | The type of the control, which must inherit from ScrollableControl. | |
| control | TControl | The scrollable control for which to set the AutoScroll property. |
| autoScroll | Boolean | A boolean value indicating whether to enable automatic scrolling. Default is false. |
Returns: TControl. The scrollable control with the updated AutoScroll property.
This method allows you to control whether the control automatically displays scroll bars when its contents exceed its visible boundaries.
myScrollableControl.AutoScroll(true);
AutoScrollMargin<TControl>(control, autoScrollMargin)
Sets the AutoScrollMargin property of the specified ScrollableControl.
| Parameter | Type | Description |
|---|---|---|
| TControl | The type of the control, must inherit from ScrollableControl. | |
| control | TControl | The control for which to set the AutoScrollMargin property. |
| autoScrollMargin | Size | A Size representing the scroll margin. |
Returns: TControl. The modified control with the updated AutoScrollMargin property.
This method allows you to specify the margin around the scrollable area of the control.
myScrollableControl.AutoScrollMargin(new Size(10, 10));
AutoScrollMinSize<TControl>(control, autoScrollMinSize)
Sets the AutoScrollMinSize property of the specified ScrollableControl.
| Parameter | Type | Description |
|---|---|---|
| TControl | The type of the control, must inherit from ScrollableControl. | |
| control | TControl | The control for which to set the AutoScrollMinSize property. |
| autoScrollMinSize | Size | A Size representing the minimum scrollable size. |
Returns: TControl. The modified control with the updated AutoScrollMinSize property.
This method allows you to specify the minimum size of the scrollable area of the control.
myScrollableControl.AutoScrollMinSize(new Size(100, 100));
OnScroll<TControl>(control, action)
Attaches a scroll event handler to a ScrollableControl.
| Parameter | Type | Description |
|---|---|---|
| TControl | The type of the scrollable control. | |
| control | TControl | The control to which the scroll event handler is attached. |
| action | Action<TControl, ScrollEventArgs> | The action to perform when the scroll event is triggered. |
Returns: TControl. The control with the attached scroll event handler.
This method allows you to easily attach a scroll event handler to a scrollable control. The provided action is executed whenever the scroll event occurs.
var myScrollableControl = new MyScrollableControl();
myScrollableControl.OnScroll((control, args) =>
{
// Handle scroll event
});
ScrollBars<TControl>(control, scrollBars)
Sets the ScrollBars property of the specified ScrollableControl.
| Parameter | Type | Description |
|---|---|---|
| TControl | The type of the control, must inherit from ScrollableControl. | |
| control | TControl | The control for which to set the ScrollBars property. |
| scrollBars | ScrollBars | A ScrollBars value indicating which scroll bars to display. |
Returns: TControl. The modified control with the updated ScrollBars property.
This method allows you to specify which scroll bars are displayed for the control. This is assumed to be part of a custom implementation.
myScrollableControl.ScrollBars(ScrollBars.Both);