DataGridViewCellParsingEventArgs.InheritedCellStyle Vlastnost

Definice

Získá nebo nastaví styl použitý na upravenou buňku.

public:
 property System::Windows::Forms::DataGridViewCellStyle ^ InheritedCellStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); void set(System::Windows::Forms::DataGridViewCellStyle ^ value); };
public System.Windows.Forms.DataGridViewCellStyle InheritedCellStyle { get; set; }
public System.Windows.Forms.DataGridViewCellStyle? InheritedCellStyle { get; set; }
member this.InheritedCellStyle : System.Windows.Forms.DataGridViewCellStyle with get, set
Public Property InheritedCellStyle As DataGridViewCellStyle

Hodnota vlastnosti

A DataGridViewCellStyle , který představuje aktuální styl upravované buňky. Výchozí hodnota je hodnota vlastnosti buňky InheritedStyle .

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.CellParsing 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.CellParsing události.

private void DataGridView1_CellParsing(Object sender, DataGridViewCellParsingEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "InheritedCellStyle", e.InheritedCellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ParsingApplied", e.ParsingApplied );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Value", e.Value );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellParsing Event" );
}
Private Sub DataGridView1_CellParsing(sender as Object, e as DataGridViewCellParsingEventArgs) _ 
     Handles DataGridView1.CellParsing

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "InheritedCellStyle", e.InheritedCellStyle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ParsingApplied", e.ParsingApplied)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Value", e.Value)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "DesiredType", e.DesiredType)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellParsing Event")

End Sub

Poznámky

Tuto vlastnost můžete použít k určení formátování buňky. Nastavení této vlastnosti nebo změna vlastností objektu, který tato vlastnost vrací, nemá žádný vliv, pokud ParsingApplied je false při ukončení obslužné rutiny události. V tomto případě se NullValuek analýze hodnoty buňky používají vlastnosti , DataSourceNullValuea FormatProvider stylu buňky.

Platí pro

Viz také