DataGridViewBand.Frozen Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy pasm zostanie przeniesiony, gdy użytkownik przewija element 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

Wartość właściwości

true jeśli nie można przewijać pasm z widoku; w przeciwnym razie , false. Wartość domyślna to false.

Przykłady

Poniższy przykład kodu blokuje pasek komórek w kolumnie i wierszu. Przykład zmienia również domyślny styl komórek zamrożonych pasm, aby określić, które przedziały są zamrożone. Ten przykład kodu jest częścią większego przykładu podanego DataGridViewBand dla klasy.

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

Uwagi

Ta właściwość może przechowywać przedział ważnych informacji, gdy użytkownik przewija element DataGridView. Zespoły sąsiadujące z zamarzniętym pasmem przeniosą się nad zamarzniętym pasmem.

Dotyczy

Zobacz też