Share via


DataGridViewImageColumn.CellTemplate Özellik

Tanım

Yeni hücreler oluşturmak için kullanılan şablonu alır veya ayarlar.

public:
 virtual property System::Windows::Forms::DataGridViewCell ^ CellTemplate { System::Windows::Forms::DataGridViewCell ^ get(); void set(System::Windows::Forms::DataGridViewCell ^ value); };
[System.ComponentModel.Browsable(false)]
public override System.Windows.Forms.DataGridViewCell CellTemplate { get; set; }
[System.ComponentModel.Browsable(false)]
public override System.Windows.Forms.DataGridViewCell? CellTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.CellTemplate : System.Windows.Forms.DataGridViewCell with get, set
Public Overrides Property CellTemplate As DataGridViewCell

Özellik Değeri

DataGridViewCell Sütundaki diğer tüm hücrelerin modellendiği bir.

Öznitelikler

Özel durumlar

Küme türü türüyle DataGridViewImageCelluyumlu değil.

Örnekler

Aşağıdaki kod örneği, bu özelliğe benzer olan özelliğinin DataGridViewColumn.CellTemplate kullanımını gösterir. Bu örnek, Nasıl yapılır: Windows Forms DataGridView Denetimindeki Sütunları Düzenleme bölümünde bulunan daha büyük bir örneğin parçasıdır.

void CustomizeCellsInThirdColumn()
{
   int thirdColumn = 2;
   DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
   DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell;
   cell->Style->BackColor = Color::Wheat;
   column->CellTemplate = cell;
}
private void CustomizeCellsInThirdColumn()
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    DataGridViewCell cell = new DataGridViewTextBoxCell();

    cell.Style.BackColor = Color.Wheat;
    column.CellTemplate = cell;
}
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

Açıklamalar

sınıfının oluşturucuları DataGridViewImageColumn bu özelliği yeni oluşturulan DataGridViewImageCellbir ile başlatır.

Dikkat

Hücre şablonunun özelliklerini değiştirmek, sütunun mevcut hücrelerinin kullanıcı arabirimini (UI) hemen etkilemez. Bu değişiklikler yalnızca sütun yeniden üretildikten sonra görünür (örneğin, sütunu sıralayarak veya yöntemine DataGridView.InvalidateColumn yapılan bir çağrı aracılığıyla).

Şunlara uygulanır

Ayrıca bkz.