DataGridViewCellStyleContentChangedEventArgs.CellStyle Vlastnost

Definice

Získá změněnou DataGridViewCellStylehodnotu .

public:
 property System::Windows::Forms::DataGridViewCellStyle ^ CellStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); };
public System.Windows.Forms.DataGridViewCellStyle CellStyle { get; }
member this.CellStyle : System.Windows.Forms.DataGridViewCellStyle
Public ReadOnly Property CellStyle As DataGridViewCellStyle

Hodnota vlastnosti

Změněná DataGridViewCellStylehodnota .

Příklady

Následující příklad kódu ukazuje použití tohoto členu. V příkladu obslužná rutina události hlásí výskyt DataGridView.CellStyleContentChanged události. Tato sestava vám pomůže zjistit, kdy k události dojde, a může vám pomoct s laděním. Pokud chcete hlásit více událostí nebo událostí, ke kterým dochází často, zvažte nahrazení MessageBox.ShowConsole.WriteLine nebo připojení zprávy k víceřádkovému TextBoxobjektu .

Pokud chcete spustit ukázkový kód, vložte ho do projektu, který obsahuje instanci typu DataGridView s názvem DataGridView1. Pak se ujistěte, že je obslužná rutina události přidružená k DataGridView.CellStyleContentChanged události.

private void DataGridView1_CellStyleContentChanged(Object sender, DataGridViewCellStyleContentChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellStyleContentChanged Event" );
}
Private Sub DataGridView1_CellStyleContentChanged(sender as Object, e as DataGridViewCellStyleContentChangedEventArgs) _ 
     Handles DataGridView1.CellStyleContentChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CellStyleScope", e.CellStyleScope)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellStyleContentChanged Event")

End Sub

Poznámky

Tuto vlastnost použijte k načtení hodnoty aktualizované DataGridViewCellStyle vlastnosti. CellStyleScope Pomocí vlastnosti určete, u které vlastnosti došlo ke DataGridViewCellStyle změně.

Platí pro

Viz také