DataGridViewCellFormattingEventArgs.RowIndex プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文書式指定するセルの行インデックス。
解説
使用例次のコード例では、RowIndex プロパティを使用して書式指定するセルを取得する方法を示します。このセルの参照は、次にセルのツールヒントのテキストを設定するために使用されます。
' Sets the ToolTip text for cells in the Rating column. Sub dataGridView1_CellFormatting(ByVal sender As Object, _ ByVal e As DataGridViewCellFormattingEventArgs) _ Handles dataGridView1.CellFormatting If e.ColumnIndex = Me.dataGridView1.Columns("Rating").Index _ AndAlso Not (e.Value Is Nothing) Then With Me.dataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex) If e.Value.Equals("*") Then .ToolTipText = "very bad" ElseIf e.Value.Equals("**") Then .ToolTipText = "bad" ElseIf e.Value.Equals("***") Then .ToolTipText = "good" ElseIf e.Value.Equals("****") Then .ToolTipText = "very good" End If End With End If End Sub 'dataGridView1_CellFormatting
// Sets the ToolTip text for cells in the Rating column. void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if ( (e.ColumnIndex == this.dataGridView1.Columns["Rating"].Index) && e.Value != null ) { DataGridViewCell cell = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (e.Value.Equals("*")) { cell.ToolTipText = "very bad"; } else if (e.Value.Equals("**")) { cell.ToolTipText = "bad"; } else if (e.Value.Equals("***")) { cell.ToolTipText = "good"; } else if (e.Value.Equals("****")) { cell.ToolTipText = "very good"; } } }
// Sets the ToolTip text for cells in the Rating column. void dataGridView1_CellFormatting(Object^ /*sender*/, DataGridViewCellFormattingEventArgs^ e) { if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index) && e->Value != nullptr ) { DataGridViewCell^ cell = this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex]; if (e->Value->Equals("*")) { cell->ToolTipText = "very bad"; } else if (e->Value->Equals("**")) { cell->ToolTipText = "bad"; } else if (e->Value->Equals("***")) { cell->ToolTipText = "good"; } else if (e->Value->Equals("****")) { cell->ToolTipText = "very good"; } } }
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照Weblioに収録されているすべての辞書からDataGridViewCellFormattingEventArgs.RowIndex プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からDataGridViewCellFormattingEventArgs.RowIndex プロパティ
を検索
- DataGridViewCellFormattingEventArgs.RowIndex プロパティのページへのリンク