DataGridView.InvalidateRow メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



行を強制的に再描画するには、このメソッドを使用します。このメソッドは、RowPrePaint イベントまたは RowPostPaint イベントを処理するオーナー描画の場合に役に立ちます。
描画と無効化の詳細については、「Invalidate」を参照してください。

行を描画するシナリオで InvalidateRow メソッドを使用する方法のコード例を次に示します。この例では、現在のセルが変更されたときに行が無効化され、行が強制的に再描画されます。
ここに示すコードは、「方法 : Windows フォームの DataGridView コントロールの行の外観をカスタマイズする」で取り上げられているコードの一部です。
' Forces the row to repaint itself when the user changes the ' current cell. This is necessary to refresh the focus rectangle. Sub dataGridView1_CurrentCellChanged(ByVal sender As Object, _ ByVal e As EventArgs) Handles dataGridView1.CurrentCellChanged If oldRowIndex <> -1 Then Me.dataGridView1.InvalidateRow(oldRowIndex) End If oldRowIndex = Me.dataGridView1.CurrentCellAddress.Y End Sub 'dataGridView1_CurrentCellChanged
// Forces the row to repaint itself when the user changes the // current cell. This is necessary to refresh the focus rectangle. void dataGridView1_CurrentCellChanged(object sender, EventArgs e) { if (oldRowIndex != -1) { this.dataGridView1.InvalidateRow(oldRowIndex); } oldRowIndex = this.dataGridView1.CurrentCellAddress.Y; }

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 名前空間
Invalidate
その他の技術情報
DataGridView コントロール (Windows フォーム)
Weblioに収録されているすべての辞書からDataGridView.InvalidateRow メソッドを検索する場合は、下記のリンクをクリックしてください。

- DataGridView.InvalidateRow メソッドのページへのリンク