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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewButtonCell クラスの意味・解説 

DataGridViewButtonCell クラス

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

DataGridView コントロール使用するボタン状のユーザー インターフェイス (UI) を表示します

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

Public Class DataGridViewButtonCell
    Inherits DataGridViewCell
Dim instance As DataGridViewButtonCell
public class DataGridViewButtonCell : DataGridViewCell
public ref class DataGridViewButtonCell : public
 DataGridViewCell
public class DataGridViewButtonCell extends
 DataGridViewCell
public class DataGridViewButtonCell extends
 DataGridViewCell
解説解説

DataGridViewButtonCell クラスは、ボタン状の UI表示するために使用される特殊な種類の DataGridViewCell です。

DataGridViewButtonColumn は、この種類セル収めるための専用の列です。既存DataGridViewButtonCell と同じセルを列内に作成するには、列の CellTemplate プロパティをそのセル設定します既定では、CellTemplate新しDataGridViewButtonCell初期化されます

列のセル関連プロパティは、テンプレート セル類似した名前を持つプロパティラッパーです。テンプレート セルプロパティ値を変更すると、そのテンプレートベースとするセルのうち、変更後追加されたものにのみ変更反映されます。一方、列のセル関連プロパティ変更すると、テンプレート セル、および列内の他のすべてのセル更新され必要に応じて列の表示更新されます。

メモメモ

visual スタイル有効にすると、ボタン列に含まれるボタンが、ButtonRenderer を使って描画されます。DefaultCellStyle などのプロパティ使って指定されセル スタイル無視されます。

継承時の注意 DataGridViewButtonCell から派生したクラス新しプロパティ追加する場合は、Clone メソッドオーバーライドして、複製処理時に新しプロパティコピーする必要がありますまた、基本クラスClone メソッド呼び出して基本クラスプロパティ新しセルコピーされるようにする必要があります

使用例使用例

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



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

辞書ショートカット

すべての辞書の索引

「DataGridViewButtonCell クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS