ScrollEventArgs Třída

Definice

Poskytuje data pro událost 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
Dědičnost
ScrollEventArgs
Atributy

Příklady

Následující příklad kódu ukazuje použití tohoto členu.

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

Poznámky

Událost Scroll nastane, když uživatel změní hodnotu posuvníku. Tato událost může být výsledkem různých akcí, jako je kliknutí na šipku posuvníku, stisknutí klávesy ŠIPKA NAHORU nebo ŠIPKA DOLŮ nebo přetažení posuvníku. Určuje ScrollEventArgs typ události posouvání, ke které došlo, a novou hodnotu posuvníku. ScrollOrientation Pomocí vlastnosti určete orientaci posuvníku Scroll události.

Událost Scroll nastane pro DataGridViewovládací prvky , ScrollableControl, ScrollBara DataGrid .

Konstruktory

ScrollEventArgs(ScrollEventType, Int32)

Inicializuje novou instanci ScrollEventArgs třídy pomocí zadaných hodnot pro Type vlastnosti a NewValue .

ScrollEventArgs(ScrollEventType, Int32, Int32)

Inicializuje novou instanci ScrollEventArgs třídy pomocí zadaných hodnot pro Typevlastnosti , OldValuea NewValue .

ScrollEventArgs(ScrollEventType, Int32, Int32, ScrollOrientation)

Inicializuje novou instanci ScrollEventArgs třídy pomocí zadaných hodnot pro Typevlastnosti , OldValue, NewValuea ScrollOrientation .

ScrollEventArgs(ScrollEventType, Int32, ScrollOrientation)

Inicializuje novou instanci ScrollEventArgs třídy pomocí zadaných hodnot pro Typevlastnosti , NewValuea ScrollOrientation .

Vlastnosti

NewValue

Získá nebo nastaví nový Value posuvník.

OldValue

Získá starý Value posuvník.

ScrollOrientation

Získá orientaci posuvníku Scroll , který vyvolal událost.

Type

Získá typ posouvání událost, ke které došlo.

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Type Získá z aktuální instance.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro

Viz také