Sdílet prostřednictvím


DataGridViewCellStyleContentChangedEventArgs.CellStyle Vlastnost

Definice

Získá změněný DataGridViewCellStyle.

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

DataGridViewCellStyleZměna .

Příklady

Následující příklad kódu ukazuje použití tohoto člena. V tomto 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 při ladění. Chcete-li 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 do víceřádkového řetězce TextBox.

Pokud chcete spustit ukázkový kód, vložte ho do projektu, který obsahuje instanci typu DataGridView s názvem DataGridView1. Potom 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í aktualizované DataGridViewCellStyle hodnoty vlastnosti. CellStyleScope Pomocí vlastnosti určete, která vlastnost se změnilaDataGridViewCellStyle.

Platí pro

Viz také