DataGridViewColumn.Frozen 속성

정의

DataGridView 컨트롤을 가로로 스크롤하면 열이 이동할지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 virtual property bool Frozen { bool get(); void set(bool value); };
public override bool Frozen { get; set; }
member this.Frozen : bool with get, set
Public Overrides Property Frozen As Boolean

속성 값

Boolean

열을 고정하면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 클래스의 DataGridViewBand.Frozen DataGridViewColumn 속성과 거의 동일한 Frozen 속성을 사용하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 DataGridViewBand 클래스입니다.

// Freeze the first row.
void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   FreezeBand( dataGridView->Rows[ 0 ] );
}

void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   FreezeBand( dataGridView->Columns[ 1 ] );
}

void FreezeBand( DataGridViewBand^ band )
{
   band->Frozen = true;
   DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle;
   style->BackColor = Color::WhiteSmoke;
   band->DefaultCellStyle = style;
}
// Freeze the first row.
private void Button4_Click(object sender, System.EventArgs e)
{

    FreezeBand(dataGridView.Rows[0]);
}

private void Button5_Click(object sender, System.EventArgs e)
{

    FreezeBand(dataGridView.Columns[1]);
}

private static void FreezeBand(DataGridViewBand band)
{
    band.Frozen = true;
    DataGridViewCellStyle style = new DataGridViewCellStyle();
    style.BackColor = Color.WhiteSmoke;
    band.DefaultCellStyle = style;
}
' Freeze the first row.
Private Sub Button4_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button4.Click

    FreezeBand(dataGridView.Rows(0))
End Sub

Private Sub FreezeColumn(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button5.Click

    FreezeBand(dataGridView.Columns(1))
End Sub

Private Shared Sub FreezeBand(ByVal band As DataGridViewBand)

    band.Frozen = True
    Dim style As DataGridViewCellStyle = New DataGridViewCellStyle()
    style.BackColor = Color.WhiteSmoke
    band.DefaultCellStyle = style

End Sub

설명

열이 고정되면 왼쪽의 모든 열(또는 오른쪽에서 왼쪽 언어의 오른쪽)도 고정됩니다. 고정된 열과 고정되지 않은 열은 두 그룹을 형성합니다. 속성을 true설정 AllowUserToOrderColumns 하여 열 위치를 변경할 수 있는 경우 사용자는 한 그룹에서 다른 그룹으로 열을 끌 수 없습니다.

적용 대상

추가 정보