ScrollEventArgs Class
Provides data for the Scroll event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() | ScrollEventArgs(ScrollEventType, Int32) | |
![]() | ScrollEventArgs(ScrollEventType, Int32, Int32) | |
![]() | ScrollEventArgs(ScrollEventType, Int32, Int32, ScrollOrientation) | Initializes a new instance of the ScrollEventArgs class using the given values for the Type, OldValue, NewValue, and ScrollOrientation properties. |
![]() | ScrollEventArgs(ScrollEventType, Int32, ScrollOrientation) | Initializes a new instance of the ScrollEventArgs class using the given values for the Type, NewValue, and ScrollOrientation properties. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The Scroll event occurs when the user changes the value of the scroll bar. This event can result from a variety of actions, such as clicking a scroll bar arrow, pressing the UP ARROW or DOWN ARROW, or dragging the scroll box. The ScrollEventArgs specifies the type of scroll event that occurred and the new value of the scroll bar. Use the ScrollOrientation property to determine the scroll bar orientation for the Scroll event.
The Scroll event occurs for the DataGridView, ScrollableControl, ScrollBar, and DataGrid controls.
The following code example demonstrates the use of this member.
void AddMyScrollEventHandlers() { // Create and initialize a VScrollBar. VScrollBar^ vScrollBar1 = gcnew VScrollBar; // Add event handlers for the OnScroll and OnValueChanged events. vScrollBar1->Scroll += gcnew ScrollEventHandler( this, &Form1::vScrollBar1_Scroll ); vScrollBar1->ValueChanged += gcnew EventHandler( this, &Form1::vScrollBar1_ValueChanged ); } // Create the ValueChanged event handler. void vScrollBar1_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Display the new value in the label. label1->Text = String::Format( "vScrollBar Value:(OnValueChanged Event) {0}", vScrollBar1->Value ); } // Create the Scroll event handler. void vScrollBar1_Scroll( Object^ /*sender*/, ScrollEventArgs^ e ) { // Display the new value in the label. label1->Text = String::Format( "VScrollBar Value:(OnScroll Event) {0}", e->NewValue ); } void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Add 40 to the Value property if it will not exceed the Maximum value. if ( vScrollBar1->Value + 40 < vScrollBar1->Maximum ) { vScrollBar1->Value = vScrollBar1->Value + 40; } }
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


