DataGridViewImageColumn.CellTemplate 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
새 셀을 만드는 데 사용되는 템플릿을 가져오거나 설정합니다.
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
속성 값
DataGridViewCell 열의 다른 모든 셀이 모델링되는 A입니다.
- 특성
예외
집합 형식이 형식 DataGridViewImageCell과 호환되지 않습니다.
예제
다음 코드 예제에서는 이 속성과 유사한 속성을 사용하는 DataGridViewColumn.CellTemplate 방법을 보여 줍니다. 이 예제는 방법: Windows Forms DataGridView 컨트롤의 열 조작에서 사용할 수 있는 더 큰 예제의 일부입니다.
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
설명
클래스의 DataGridViewImageColumn 생성자는 이 속성을 새로 만든 DataGridViewImageCell속성으로 초기화합니다.
주의
셀 템플릿의 속성을 변경해도 열의 기존 셀의 UI(사용자 인터페이스)는 즉시 영향을 받지 않습니다. 이러한 변경 내용은 열이 다시 생성된 후에만 표시됩니다(예: 열을 정렬하거나 메서드 호출 DataGridView.InvalidateColumn 을 통해).