Sdílet prostřednictvím


DataGridViewCellStyleContentChangedEventArgs.CellStyleScope Vlastnost

Definice

Získá obor, který je ovlivněn změněným stylem buňky.

public:
 property System::Windows::Forms::DataGridViewCellStyleScopes CellStyleScope { System::Windows::Forms::DataGridViewCellStyleScopes get(); };
public System.Windows.Forms.DataGridViewCellStyleScopes CellStyleScope { get; }
member this.CellStyleScope : System.Windows.Forms.DataGridViewCellStyleScopes
Public ReadOnly Property CellStyleScope As DataGridViewCellStyleScopes

Hodnota vlastnosti

Označuje DataGridViewCellStyleScopes , která DataGridView entita vlastní styl buňky, který se změnil.

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

CellStyleScope Pomocí vlastnosti určete, která vlastnost se změnilaDataGridViewCellStyle. CellStyle Pomocí vlastnosti načtěte aktualizovanou hodnotu.

Platí pro

Viz také