DataGridViewCheckBoxColumn.CellTemplate プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCheckBoxColumn.CellTemplate プロパティの意味・解説 

DataGridViewCheckBoxColumn.CellTemplate プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

新しセル作成使用するテンプレート取得または設定します

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

Public Overrides Property
 CellTemplate As DataGridViewCell
Dim instance As DataGridViewCheckBoxColumn
Dim value As DataGridViewCell

value = instance.CellTemplate

instance.CellTemplate = value
public override DataGridViewCell CellTemplate { get;
 set; }
public:
virtual property DataGridViewCell^ CellTemplate {
    DataGridViewCell^ get () override;
    void set (DataGridViewCell^ value) override;
}
/** @property */
public DataGridViewCell get_CellTemplate ()

/** @property */
public void set_CellTemplate (DataGridViewCell
 value)
public override function get
 CellTemplate () : DataGridViewCell

public override function set
 CellTemplate (value : DataGridViewCell)

プロパティ
列に含まれる他のすべてのセルモデルとする DataGridViewCell。既定値は DataGridViewCheckBoxCell の新しインスタンスです。

例外例外
例外種類条件

InvalidCastException

プロパティDataGridViewCheckBoxCell 型でない値に設定されています。

解説解説

DataGridViewCheckBoxColumn クラスコンストラクタは、このプロパティ新しく作成されDataGridViewCheckBoxCell初期化します。

注意に関するメモ注意

セル テンプレートプロパティ変更しても、列の既存セルユーザー インターフェイス (UI) に直ち反映されることはありません。この変更は、列が再生成されたとき (列を並べ替えたり DataGridView.InvalidateColumn メソッド呼び出したりした場合など) に、初め反映されます。

使用例使用例

次のコード例は、DataGridViewCheckBoxColumn使用して外出している従業員マークする方法示してます。セル テンプレート使用してチェック ボックス列に含まれるすべてのセルに同じ色を適用してます。

Private Sub AddOutOfOfficeColumn()
    Dim column As New DataGridViewCheckBoxColumn()
    With column
        .HeaderText = ColumnName.OutOfOffice.ToString()
        .Name = ColumnName.OutOfOffice.ToString()
        .AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
        .FlatStyle = FlatStyle.Standard
        .CellTemplate = New DataGridViewCheckBoxCell()
        .CellTemplate.Style.BackColor = Color.Beige
    End With

    DataGridView1.Columns.Insert(0, column)
End Sub
private void AddOutOfOfficeColumn()
{
    DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
    {
        column.HeaderText = ColumnName.OutOfOffice.ToString();
        column.Name = ColumnName.OutOfOffice.ToString();
        column.AutoSizeMode = 
            DataGridViewAutoSizeColumnMode.DisplayedCells;
        column.FlatStyle = FlatStyle.Standard;
        column.ThreeState = true;
        column.CellTemplate = new DataGridViewCheckBoxCell();
        column.CellTemplate.Style.BackColor = Color.Beige;
    }

    DataGridView1.Columns.Insert(0, column);
}
private:
    void AddOutOfOfficeColumn()
    {
        DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn();
        {
            column->HeaderText = ColumnName::OutOfOffice.ToString();
            column->Name = ColumnName::OutOfOffice.ToString();
            column->AutoSizeMode = 
                DataGridViewAutoSizeColumnMode::DisplayedCells;
            column->FlatStyle = FlatStyle::Standard;
            column->ThreeState = true;
            column->CellTemplate = gcnew DataGridViewCheckBoxCell();
            column->CellTemplate->Style->BackColor = Color::Beige;
        }

        DataGridView1->Columns->Insert(0, column);
    }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCheckBoxColumn クラス
DataGridViewCheckBoxColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewCheckBoxColumn
DataGridViewCell クラス
DataGridViewCheckBoxCell クラス
DataGridView.InvalidateColumn



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

辞書ショートカット

すべての辞書の索引

「DataGridViewCheckBoxColumn.CellTemplate プロパティ」の関連用語

DataGridViewCheckBoxColumn.CellTemplate プロパティのお隣キーワード
検索ランキング

   

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



DataGridViewCheckBoxColumn.CellTemplate プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS