DataGridViewTextBoxColumn.CellTemplate Özellik

Tanım

Hücre görünümünü modellemek 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)>]
member this.CellTemplate : System.Windows.Forms.DataGridViewCell with get, set
Public Overrides Property CellTemplate As DataGridViewCell

Özellik Değeri

DataGridViewCell

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

Öznitelikler

Özel durumlar

Küme türü türüyle DataGridViewTextBoxCelluyumlu 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, How to: Manipulate Columns in the Windows Forms DataGridView Control (Windows Forms DataGridView Denetimindeki Sütunları Değiştirme) bölümünde bulunan daha büyük bir örneğin bir 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şturucu DataGridViewTextBoxColumn bu özelliğini yeni oluşturulan DataGridViewTextBoxCellbir öğesine 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.