PropertyGrid.PropertyValueChanged イベント

定義

プロパティ値が変更するときに発生します。

public:
 event System::Windows::Forms::PropertyValueChangedEventHandler ^ PropertyValueChanged;
public event System.Windows.Forms.PropertyValueChangedEventHandler PropertyValueChanged;
public event System.Windows.Forms.PropertyValueChangedEventHandler? PropertyValueChanged;
member this.PropertyValueChanged : System.Windows.Forms.PropertyValueChangedEventHandler 
Public Custom Event PropertyValueChanged As PropertyValueChangedEventHandler 

イベントの種類

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

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

private void PropertyGrid1_PropertyValueChanged(Object sender, PropertyValueChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ChangedItem", e.ChangedItem );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "OldValue", e.OldValue );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "PropertyValueChanged Event" );
}
Private Sub PropertyGrid1_PropertyValueChanged(sender as Object, e as PropertyValueChangedEventArgs) _ 
     Handles PropertyGrid1.PropertyValueChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ChangedItem", e.ChangedItem)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "OldValue", e.OldValue)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"PropertyValueChanged Event")

End Sub

注釈

イベントの処理の詳細については、「処理とイベントの発生」を参照してください。

適用対象