DataGridViewBand.Frozen Propriedade

Definição

Obtém ou define um valor que indica se a faixa se moverá quando o usuário rolar pelo DataGridView.

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

Valor da propriedade

Boolean

true se a faixa não puder ser rolada na exibição; caso contrário, false. O padrão é false.

Exemplos

O exemplo de código a seguir congela uma faixa de células em uma coluna e uma linha. O exemplo também altera o estilo de célula padrão das faixas congeladas para especificar quais faixas estão congeladas. Este exemplo de código faz parte de um exemplo maior fornecido para a DataGridViewBand classe.

// 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

Comentários

Essa propriedade pode conter uma faixa de informações importantes quando um usuário rola pelo DataGridView. Bandas adjacentes à banda congelada se moverão sobre a banda congelada.

Aplica-se a

Confira também