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

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

DataGridViewLinkColumn.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 DataGridViewLinkColumn
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。既定値は DataGridViewLinkCell の新しいインスタンスです。

例外例外
例外の種類条件

InvalidCastException

このプロパティが DataGridViewLinkCell 型でない値に設定されています。

解説解説

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

注意に関するメモ注意

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

使用例使用例

DataGridViewColumn のテンプレートとして DataGridViewCell を使用する方法のコード例を次に示します。列のセルのスタイルの変更は、その列のすべてのセルに影響します。このコード例は、DataGridViewColumn クラスのトピックで取り上げているコード例の一部分です。

Private Sub CustomizeCellsInThirdColumn()

    Dim thirdColumn As Integer
 = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    Dim cell As DataGridViewCell = _
        New DataGridViewTextBoxCell()

    cell.Style.BackColor = Color.Wheat
    column.CellTemplate = cell
End Sub
private void CustomizeCellsInThirdColumn()
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    DataGridViewCell cell = new DataGridViewTextBoxCell();

    cell.Style.BackColor = Color.Wheat;
    column.CellTemplate = cell;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewLinkColumn クラス
DataGridViewLinkColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewLinkColumn
DataGridViewCell クラス
DataGridViewLinkCell クラス
DataGridView.InvalidateColumn



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

DataGridViewLinkColumn.CellTemplate プロパティのお隣キーワード

   

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



DataGridViewLinkColumn.CellTemplate プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS