Share via


DataGridViewCellParsingEventArgs.InheritedCellStyle Özellik

Tanım

Düzenlenen hücreye uygulanan stili alır veya ayarlar.

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

Özellik Değeri

DataGridViewCellStyle Düzenlenmekte olan hücrenin geçerli stilini temsil eden bir. Varsayılan değer, hücre InheritedStyle özelliğinin değeridir.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu DataGridView.CellParsing raporlar. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile Console.WriteLine değiştirmeyi MessageBox.Show veya iletiyi çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı DataGridView1bir tür DataGridView örneği içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden DataGridView.CellParsing emin olun.

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

Açıklamalar

Hücrenin geçerli biçimlendirmesini belirlemek için bu özelliği kullanabilirsiniz. Bu özelliğin ayarlanması veya bu özelliğin döndürdüğü nesnenin özelliklerini değiştirmenin, olay işleyicisi çıkış yapmadığı sürece ParsingAppliedfalse hiçbir etkisi olmaz. Bu durumda, NullValuehücre değerini ayrıştırmak için hücre stilinin , DataSourceNullValueve FormatProvider özellikleri kullanılır.

Şunlara uygulanır

Ayrıca bkz.