ScrollEventArgs Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Fournit des données pour l’événement 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
- Héritage
- Attributs
Exemples
L’exemple de code suivant illustre l’utilisation de ce membre.
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
Remarques
L’événement Scroll se produit lorsque l’utilisateur modifie la valeur de la barre de défilement. Cet événement peut provenir de diverses actions, telles que le fait de cliquer sur une flèche de barre de défilement, d’appuyer sur la flèche haut ou vers le bas ou de faire glisser la zone de défilement. Spécifie ScrollEventArgs le type d’événement de défilement qui s’est produit et la nouvelle valeur de la barre de défilement. Utilisez la ScrollOrientation propriété pour déterminer l’orientation de la barre de défilement pour l’événement Scroll .
L’événement Scroll se produit pour les contrôles , et DataGridScrollBarles DataGridViewcontrôlesScrollableControl.
Constructeurs
| Nom | Description |
|---|---|
| ScrollEventArgs(ScrollEventType, Int32, Int32, ScrollOrientation) |
Initialise une nouvelle instance de la ScrollEventArgs classe à l’aide des valeurs données pour les propriétés et ScrollOrientationOldValueNewValueles Typepropriétés. |
| ScrollEventArgs(ScrollEventType, Int32, Int32) |
Initialise une nouvelle instance de la ScrollEventArgs classe à l’aide des valeurs données pour les propriétés et NewValue les TypeOldValuepropriétés. |
| ScrollEventArgs(ScrollEventType, Int32, ScrollOrientation) |
Initialise une nouvelle instance de la ScrollEventArgs classe à l’aide des valeurs données pour les propriétés et ScrollOrientation les TypeNewValuepropriétés. |
| ScrollEventArgs(ScrollEventType, Int32) |
Initialise une nouvelle instance de la ScrollEventArgs classe à l’aide des valeurs données pour les propriétés et NewValue les Type propriétés. |
Propriétés
| Nom | Description |
|---|---|
| NewValue |
Obtient ou définit la nouvelle Value de la barre de défilement. |
| OldValue |
Obtient l’ancien Value de la barre de défilement. |
| ScrollOrientation |
Obtient l’orientation de la barre de défilement qui a déclenché l’événement |
| Type |
Obtient le type d’événement de défilement qui s’est produit. |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |