DataGridViewCellParsingEventArgs.InheritedCellStyle プロパティ

定義

編集されたセルに適用されるスタイルを取得または設定します。

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

プロパティ値

編集されているセルの現在のスタイルを表す DataGridViewCellStyle。 既定値はセルの InheritedStyle プロパティの値です。

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの DataGridView.CellParsing 発生を報告します。 このレポートは、イベントが発生したタイミングを知るのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。

コード例を実行するには、 という名前DataGridView1の型DataGridViewのインスタンスを含むプロジェクトに貼り付けます。 次に、イベント ハンドラーが イベントに関連付けられていることを確認します DataGridView.CellParsing

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

注釈

このプロパティを使用すると、セルに有効な書式を決定できます。 このプロパティを設定するか、このプロパティが返すオブジェクトのプロパティを変更しても、イベント ハンドラーが終了するときに が でないfalse限りParsingApplied、効果はありません。 この場合、セル スタイルの NullValueDataSourceNullValue、および FormatProvider プロパティを使用して、セル値を解析します。

適用対象

こちらもご覧ください