ScrollEventArgs Class
Provides data for the Scroll event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The ScrollEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ScrollEventArgs(ScrollEventType, Int32) | Initializes a new instance of the ScrollEventArgs class using the given values for the Type and NewValue properties. |
![]() | ScrollEventArgs(ScrollEventType, Int32, Int32) | Initializes a new instance of the ScrollEventArgs class using the given values for the Type, OldValue, and NewValue properties. |
![]() | ScrollEventArgs(ScrollEventType, Int32, ScrollOrientation) | Initializes a new instance of the ScrollEventArgs class using the given values for the Type, NewValue, and ScrollOrientation properties. |
![]() | 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. |
| 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 a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | 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; } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
