ScrollBar Class
Definition
Section titled “Definition”Represents a scrollbar control.
[DataContract]public class ScrollBar : ControlBaseInheritance object → ControlBase
Constructors
Section titled “Constructors”ScrollBar(Orientation, int)
Section titled “ScrollBar(Orientation, int)”Creates a new Slider control
public ScrollBar(Orientation orientation, int size)Parameters
Section titled “Parameters”orientation Orientation
Sets the control to either horizontal or vertical.
size int
The height or width of the control, based on the orientation, with a thickness of 1.
Exceptions
Section titled “Exceptions”ArgumentOutOfRangeException
Size of the control must be 2 or more
ScrollBar(Orientation, int, int)
Section titled “ScrollBar(Orientation, int, int)”Creates a new Slider control with the specified width and height.
public ScrollBar(Orientation orientation, int width, int height)Parameters
Section titled “Parameters”orientation Orientation
Sets the control to either horizontal or vertical.
width int
The width the control.
height int
The height of the control.
Exceptions
Section titled “Exceptions”ArgumentOutOfRangeException
With a horizontal Slider, width must be 2 or more. With a vertical Slider, height must be 2 or more.
Properties
Section titled “Properties”Orientation
Section titled “Orientation”Indicates if the slider is horizontal or vertical.
[DataMember]public Orientation Orientation { get; }IsGripped
Section titled “IsGripped”When true, indicates that the mouse is gripping the slider to scroll.
public bool IsGripped { get; }MaximumValue
Section titled “MaximumValue”Gets or sets the maximum value for the scrollbar.
[DataMember]public int MaximumValue { get; set; }ArrowStep
Section titled “ArrowStep”Gets or sets the amount of values to add or subtract to the Value when the up or down arrows are used.
[DataMember]public int ArrowStep { get; set; }MouseWheelStep
Section titled “MouseWheelStep”Gets or sets the amount of values to add or subtract to the Value when the up or down arrows are used.
[DataMember]public int MouseWheelStep { get; set; }Gets or sets the value of the slider between the minimum and maximum values.
[DataMember]public int Value { get; set; }ArrowsMoveGrip
Section titled “ArrowsMoveGrip”When true, the arrow buttons simply move the grip instead of using the ArrowStep value to adjust the value.
[DataMember]public bool ArrowsMoveGrip { get; set; }MouseWheelMovesGrip
Section titled “MouseWheelMovesGrip”When true, the mouse wheelsimply moves the grip instead of using the MouseWheelStep value to adjust the value.
[DataMember]public bool MouseWheelMovesGrip { get; set; }The style applied to drawing the control.
[DataMember]public ScrollBar.ThemeStyle Style { get; set; }Methods
Section titled “Methods”OnValueChanged()
Section titled “OnValueChanged()”Invokes the ValueChanged event.
protected void OnValueChanged()CalculateGripSize()
Section titled “CalculateGripSize()”Sets the bar and grip sizes of the control.
protected void CalculateGripSize()SetGripToValue()
Section titled “SetGripToValue()”Moves the grip position based on the Value property.
protected void SetGripToValue()OnResized()
Section titled “OnResized()”Resizes the control and recalculates the grip size.
protected override void OnResized()SetValue(int, bool)
Section titled “SetValue(int, bool)”Sets the value of the control without using the Value property. Optionally calls SetGripToValue().
protected void SetValue(int value, bool setGrip = true)Parameters
Section titled “Parameters”value int
The value to set.
setGrip bool
Moves the grip when true.
IncreaseValue(int)
Section titled “IncreaseValue(int)”Increases the value by the specified amount.
public void IncreaseValue(int value)Parameters
Section titled “Parameters”value int
The value to add to Value.
DecreaseValue(int)
Section titled “DecreaseValue(int)”Decreases the value by the specified amount.
public void DecreaseValue(int value)Parameters
Section titled “Parameters”value int
The value to subract from Value.
IncreaseGripByOne()
Section titled “IncreaseGripByOne()”Increases the grip position by one and sets the value.
public void IncreaseGripByOne()DecreaseGripByOne()
Section titled “DecreaseGripByOne()”Decreases the grip position by one and sets the value.
public void DecreaseGripByOne()ProcessMouseWheel(MouseScreenObjectState)
Section titled “ProcessMouseWheel(MouseScreenObjectState)”Processes the mouse wheel values regardless of if the mouse is over the scrollbar or not.
public bool ProcessMouseWheel(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
The mouse state.
Returns
Section titled “Returns”bool
True if the mouse wheel was processed.
ProcessMouse(MouseScreenObjectState)
Section titled “ProcessMouse(MouseScreenObjectState)”Checks if the mouse is the control and calls the appropriate mouse methods.
public override bool ProcessMouse(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Mouse information.
Returns
Section titled “Returns”bool
True when the control is enabled, set to use the mouse and the mouse is over it, otherwise false.
UpdateAndRedraw(TimeSpan)
Section titled “UpdateAndRedraw(TimeSpan)”Redraws the control if applicable.
public override void UpdateAndRedraw(TimeSpan time)Parameters
Section titled “Parameters”time TimeSpan
The duration of thecurrent frame.
Events
Section titled “Events”ValueChanged
Section titled “ValueChanged”Raised when the Value property changes.
public event EventHandler? ValueChanged