DataGridViewCellParsingEventArgs.InheritedCellStyle Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar eller anger det format som tillämpas på den redigerade cellen.
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
Egenskapsvärde
En DataGridViewCellStyle som representerar det aktuella formatet för cellen som redigeras. Standardvärdet är värdet för cellegenskapen InheritedStyle .
Exempel
Följande kodexempel visar hur den här medlemmen används. I exemplet rapporterar en händelsehanterare om händelsens DataGridView.CellParsing förekomst. Den här rapporten hjälper dig att lära dig när händelsen inträffar och kan hjälpa dig att felsöka. Om du vill rapportera om flera händelser eller händelser som inträffar ofta kan du överväga att MessageBox.Show ersätta med Console.WriteLine eller lägga till meddelandet i en flerradig TextBox.
Om du vill köra exempelkoden klistrar du in den i ett projekt som innehåller en instans av typen DataGridView med namnet DataGridView1. Kontrollera sedan att händelsehanteraren är associerad med DataGridView.CellParsing händelsen.
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
Kommentarer
Du kan använda den här egenskapen för att fastställa vilken formatering som gäller för cellen. Att ange den här egenskapen eller ändra egenskaperna för det objekt som den här egenskapen returnerar har ingen effekt om inte ParsingApplied är false när händelsehanteraren avslutas. I det här fallet NullValueanvänds egenskaperna , DataSourceNullValueoch FormatProvider för cellformatet för att parsa cellvärdet.