ScrollEventArgs Klasa

Definicja

Udostępnia dane dla zdarzenia Scroll.

public ref class ScrollEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class ScrollEventArgs : EventArgs
public class ScrollEventArgs : EventArgs
[<System.Runtime.InteropServices.ComVisible(true)>]
type ScrollEventArgs = class
    inherit EventArgs
type ScrollEventArgs = class
    inherit EventArgs
Public Class ScrollEventArgs
Inherits EventArgs
Dziedziczenie
ScrollEventArgs
Atrybuty

Przykłady

Poniższy przykład kodu przedstawia użycie tego elementu członkowskiego.

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;
   }
}
private void AddMyScrollEventHandlers()
 {
    // Create and initialize a VScrollBar.
    VScrollBar vScrollBar1 = new VScrollBar();
 
    // Add event handlers for the OnScroll and OnValueChanged events.
    vScrollBar1.Scroll += new ScrollEventHandler(
       this.vScrollBar1_Scroll);
    vScrollBar1.ValueChanged += new EventHandler(
       this.vScrollBar1_ValueChanged); 
 }
 
 // Create the ValueChanged event handler.
 private void vScrollBar1_ValueChanged(Object sender, 
                                       EventArgs e)
 {
     // Display the new value in the label.
     label1.Text = "vScrollBar Value:(OnValueChanged Event) " + vScrollBar1.Value.ToString();
 }
 
 // Create the Scroll event handler.
 private void vScrollBar1_Scroll(Object sender, 
                                 ScrollEventArgs e)
 {
     // Display the new value in the label.
     label1.Text = "VScrollBar Value:(OnScroll Event) " + e.NewValue.ToString();
 }
 
 private 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;
    }
 }
Private Sub AddMyScrollEventHandlers()
    ' Create and initialize a VScrollBar.
    Dim vScrollBar1 As New VScrollBar()
    
    ' Add event handlers for the OnScroll and OnValueChanged events.
    AddHandler vScrollBar1.Scroll, AddressOf Me.vScrollBar1_Scroll
    AddHandler vScrollBar1.ValueChanged, AddressOf Me.vScrollBar1_ValueChanged
End Sub    

' Create the ValueChanged event handler.
Private Sub vScrollBar1_ValueChanged(sender As Object, e As EventArgs)
    ' Display the new value in the label.
    label1.Text = "vScrollBar Value:(OnValueChanged Event) " & _
        vScrollBar1.Value.ToString()
End Sub    

' Create the Scroll event handler.
Private Sub vScrollBar1_Scroll(sender As Object, e As ScrollEventArgs)
    ' Display the new value in the label.
    label1.Text = "VScrollBar Value:(OnScroll Event) " & _
        e.NewValue.ToString()
End Sub    

Private Sub button1_Click(sender As Object, e As EventArgs)
    ' Add 40 to the Value property if it will not exceed the Maximum value.
    If vScrollBar1.Value + 40 < vScrollBar1.Maximum Then
        vScrollBar1.Value = vScrollBar1.Value + 40
    End If
End Sub

Uwagi

Zdarzenie Scroll występuje, gdy użytkownik zmienia wartość paska przewijania. To zdarzenie może wynikać z różnych akcji, takich jak kliknięcie strzałki paska przewijania, naciśnięcie strzałki w górę lub strzałkę w dół lub przeciągnięcie pola przewijania. Określa ScrollEventArgs typ zdarzenia przewijania, które wystąpiło, i nową wartość paska przewijania. Użyj właściwości , ScrollOrientation aby określić orientację paska przewijania Scroll dla zdarzenia.

Zdarzenie Scroll występuje dla kontrolek DataGridView, ScrollableControl, ScrollBari DataGrid .

Konstruktory

ScrollEventArgs(ScrollEventType, Int32)

Inicjuje nowe wystąpienie klasy przy użyciu podanych ScrollEventArgs wartości właściwości Type i NewValue .

ScrollEventArgs(ScrollEventType, Int32, Int32)

Inicjuje nowe wystąpienie klasy przy użyciu podanych ScrollEventArgs wartości dla Typewłaściwości , OldValuei NewValue .

ScrollEventArgs(ScrollEventType, Int32, Int32, ScrollOrientation)

Inicjuje nowe wystąpienie klasy przy użyciu podanych ScrollEventArgs wartości dla Typewłaściwości , OldValue, NewValuei ScrollOrientation .

ScrollEventArgs(ScrollEventType, Int32, ScrollOrientation)

Inicjuje nowe wystąpienie klasy przy użyciu podanych ScrollEventArgs wartości dla Typewłaściwości , NewValuei ScrollOrientation .

Właściwości

NewValue

Pobiera lub ustawia nowy Value pasek przewijania.

OldValue

Pobiera stary Value pasek przewijania.

ScrollOrientation

Pobiera orientację paska przewijania, która wzbudziła Scroll zdarzenie.

Type

Pobiera typ zdarzenia przewijania, które wystąpiło.

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też