DataGridViewCheckBoxColumn.DefaultCellStyle 속성

정의

열의 기본 셀 스타일을 가져오거나 설정합니다.Gets or sets the column's default cell style.

public:
 virtual property System::Windows::Forms::DataGridViewCellStyle ^ DefaultCellStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); void set(System::Windows::Forms::DataGridViewCellStyle ^ value); };
[System.ComponentModel.Browsable(true)]
public override System.Windows.Forms.DataGridViewCellStyle DefaultCellStyle { get; set; }
member this.DefaultCellStyle : System.Windows.Forms.DataGridViewCellStyle with get, set
Public Overrides Property DefaultCellStyle As DataGridViewCellStyle

속성 값

기본 스타일로 적용할 DataGridViewCellStyle입니다.The DataGridViewCellStyle to be applied as the default style.

특성

예제

다음 코드 예제에서는이 속성을 사용 하는 방법을 보여 줍니다.The following code example demonstrates the use of this property.

private void ChangeColumnAlignment()
{
    songsDataGridView.Columns["Title"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter;
    songsDataGridView.Columns["Title"].Name = DataGridViewContentAlignment.BottomCenter.ToString();

    songsDataGridView.Columns["Artist"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomLeft;
    songsDataGridView.Columns["Artist"].Name = DataGridViewContentAlignment.BottomLeft.ToString();

    songsDataGridView.Columns["Album"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight;
    songsDataGridView.Columns["Album"].Name = DataGridViewContentAlignment.BottomRight.ToString();

    songsDataGridView.Columns["Release Date"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
    songsDataGridView.Columns["Release Date"].Name = DataGridViewContentAlignment.MiddleCenter.ToString();

    songsDataGridView.Columns["Track"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
    songsDataGridView.Columns["Track"].Name = DataGridViewContentAlignment.MiddleLeft.ToString();
}
Private Sub ChangeColumnAlignment()
    songsDataGridView.Columns("Title").DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter
    songsDataGridView.Columns("Title").Name = DataGridViewContentAlignment.BottomCenter.ToString()

    songsDataGridView.Columns("Artist").DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomLeft
    songsDataGridView.Columns("Artist").Name = DataGridViewContentAlignment.BottomLeft.ToString()

    songsDataGridView.Columns("Album").DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight
    songsDataGridView.Columns("Album").Name = DataGridViewContentAlignment.BottomRight.ToString()

    songsDataGridView.Columns("Release Date").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
    songsDataGridView.Columns("Release Date").Name = DataGridViewContentAlignment.MiddleCenter.ToString()

    songsDataGridView.Columns("Track").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft
    songsDataGridView.Columns("Track").Name = DataGridViewContentAlignment.MiddleLeft.ToString()
End Sub

설명

기본 DataGridViewCellStyle 이 반환한 속성에는 다음 초기 속성 값:The default DataGridViewCellStyle returned by this property has the following initial property values:

DataGridViewCellStyle 속성DataGridViewCellStyle property 기본값Default value
Alignment DataGridViewContentAlignment.MiddleCenter
NullValue CheckState.Indeterminate 경우 초기 ThreeState 속성 값이 true이 고, 그렇지 않으면 false합니다.CheckState.Indeterminate if the initial ThreeState property value is true; otherwise, false.

이러한 값에 지정 된 값을 재정의 합니다 DefaultCellStyle 속성의는 DataGridView 제어, 하지만 다른 셀 스타일 속성에 의해 재정의 될 수 있습니다.These values override the value specified in the DefaultCellStyle property of the DataGridView control, but may be overridden by other cell style properties. 자세한 내용은 Windows Forms DataGridView 컨트롤의 셀 스타일합니다.For more information, see Cell Styles in the Windows Forms DataGridView Control.

경우는 NullValue 반환 하는 개체의 속성을 DefaultCellStyle 속성의 값이 false변경는 ThreeState 속성 값을 true 자동으로 설정 NullValueIndeterminate.If the NullValue property of the object returned by the DefaultCellStyle property has a value of false, changing the ThreeState property value to true automatically sets NullValue to Indeterminate. 경우 NullValue 값이 Indeterminate을 변경 합니다 ThreeState 속성 값을 false 자동으로 설정 NullValuefalse입니다.If NullValue has a value of Indeterminate, changing the ThreeState property value to false automatically sets NullValue to false.

적용 대상

추가 정보