DataGridView.CurrentCellAddress プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

現在アクティブなセルの行インデックスおよび列インデックスを表す Point。

セルに直接アクセスせずに現在のセルの行および列を確認するには、このプロパティを使用します。これは、共有行が非共有にならないようにする場合に便利です。行の共有の詳細については、「Windows フォーム DataGridView コントロールを拡張するための推奨される手順」を参照してください。

行を描画するシナリオで CurrentCellAddress プロパティを使用する方法のコード例を次に示します。この例では、このプロパティは現在のセルの行インデックスを格納するために使用されます。ユーザーが現在のセルを別の行に変更すると、行は強制的に再描画されます。
ここに示すコードは、「方法 : 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 名前空間
その他の技術情報
DataGridView コントロール (Windows フォーム)
Weblioに収録されているすべての辞書からDataGridView.CurrentCellAddress プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataGridView.CurrentCellAddress プロパティのページへのリンク