次の方法で共有


DataGrid.Scroll イベント

ユーザーが System.Windows.Forms.DataGrid コントロールをスクロールすると発生します。

Public Event Scroll As EventHandler
[C#]
public event EventHandler Scroll;
[C++]
public: __event EventHandler* Scroll;

[JScript] JScript では、このクラスで定義されているイベントを処理できます。ただし、独自に定義することはできません。

イベント データ

イベント ハンドラが EventArgs 型の引数を受け取りました。

使用例

 
' Create an instance of the 'Scroll' EventHandler.
Private Sub CallScroll()
   AddHandler myDataGrid.Scroll, AddressOf Grid_Scroll
End Sub 'CallScroll


' Raise the event when DataGrid is scrolled.
Protected Sub Grid_Scroll(sender As Object, e As EventArgs)
   ' String variable used to show message.
   Dim myString As String = "Scroll event raised, DataGrid is scrolled"
   ' Show the message when scrolling is done.
   MessageBox.Show(myString, "Scroll information")
End Sub 'Grid_Scroll

[C#] 
// Create an instance of the 'Scroll' EventHandler.
private void CallScroll()
{
   myDataGrid.Scroll += new EventHandler(Grid_Scroll);
}

// Raise the event when DataGrid is scrolled.
protected void Grid_Scroll(object sender, EventArgs e)
{
   // String variable used to show message.
   string myString = "Scroll event raised, DataGrid is scrolled";
   // Show the message when scrolling is done.
   MessageBox.Show(myString, "Scroll information");
}

[C++] 
// Create an instance of the 'Scroll' EventHandler.
private:
void CallScroll() {
    myDataGrid->Scroll += new EventHandler(this, &MyDataGrid::Grid_Scroll);
}

// Raise the event when DataGrid is scrolled.
protected:
void Grid_Scroll(Object* /*sender*/, EventArgs* /*e*/) {
    // String variable used to show message.
    String* myString = S"Scroll event raised, DataGrid is scrolled";
    // Show the message when scrolling is done.
    MessageBox::Show(myString, S"Scroll information");
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DataGrid クラス | DataGrid メンバ | System.Windows.Forms 名前空間