DataGridView.RowLeave イベント
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As DataGridView Dim handler As DataGridViewCellEventHandler AddHandler instance.RowLeave, handler
public: event DataGridViewCellEventHandler^ RowLeave { void add (DataGridViewCellEventHandler^ value); void remove (DataGridViewCellEventHandler^ value); }


このイベントを処理して、現在の行のセルの BackColor プロパティを変更する方法を次のコード例に示します。この例では、背景色は RowEnter イベントで設定され、RowLeave イベントで Empty にリセットされます。この例を実行するには、dataGridView1 という名前の DataGridView が配置されているフォームにコードを貼り付け、すべてのイベントを確実にイベント ハンドラに関連付けます。
Private Sub dataGridView1_RowEnter(ByVal sender As Object, _ ByVal e As DataGridViewCellEventArgs) _ Handles dataGridView1.RowEnter Dim i As Integer For i = 0 To dataGridView1.Rows(e.RowIndex).Cells.Count - 1 dataGridView1(i, e.RowIndex).Style _ .BackColor = Color.Yellow Next i End Sub Private Sub dataGridView1_RowLeave(ByVal sender As Object, _ ByVal e As DataGridViewCellEventArgs) _ Handles dataGridView1.RowLeave Dim i As Integer For i = 0 To dataGridView1.Rows(e.RowIndex).Cells.Count - 1 dataGridView1(i, e.RowIndex).Style _ .BackColor = Color.Empty Next i End Sub
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dataGridView1.Rows[e.RowIndex].Cells.Count; i++) { dataGridView1[i, e.RowIndex].Style.BackColor = Color.Yellow; } } private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dataGridView1.Rows[e.RowIndex].Cells.Count; i++) { dataGridView1[i, e.RowIndex].Style.BackColor = Color.Empty; } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataGridView クラス
DataGridView メンバ
System.Windows.Forms 名前空間
その他の技術情報
DataGridView コントロール (Windows フォーム)
Weblioに収録されているすべての辞書からDataGridView.RowLeave イベントを検索する場合は、下記のリンクをクリックしてください。

- DataGridView.RowLeave イベントのページへのリンク