DataGridViewCell クラスとは? わかりやすく解説

DataGridViewCell クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

DataGridView コントロール個別セル表します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public MustInherit Class
 DataGridViewCell
    Inherits DataGridViewElement
    Implements ICloneable, IDisposable
Dim instance As DataGridViewCell
public abstract class DataGridViewCell : DataGridViewElement,
 ICloneable, IDisposable
public ref class DataGridViewCell abstract
 : public DataGridViewElement, ICloneable, IDisposable
public abstract class DataGridViewCell extends
 DataGridViewElement implements ICloneable, IDisposable
public abstract class DataGridViewCell extends
 DataGridViewElement implements ICloneable, IDisposable
解説解説
使用例使用例

この型の使用方法次のコード例示します。この例の詳細については、「方法 : Windows フォーム DataGridView コントロールの各セルツールヒント追加する」を参照してください

' 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";
        }
    }
}
継承階層継承階層
System.Object
   System.Windows.Forms.DataGridViewElement
    System.Windows.Forms.DataGridViewCell
       派生クラス
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス
System.ICloneable
System.IDisposable



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewCell クラス」の関連用語

DataGridViewCell クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewCell クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS