Bagikan melalui


PropertyValueChangedEventArgs.ChangedItem Properti

Definisi

GridItem Mendapatkan yang diubah.

public:
 property System::Windows::Forms::GridItem ^ ChangedItem { System::Windows::Forms::GridItem ^ get(); };
public System.Windows.Forms.GridItem ChangedItem { get; }
public System.Windows.Forms.GridItem? ChangedItem { get; }
member this.ChangedItem : System.Windows.Forms.GridItem
Public ReadOnly Property ChangedItem As GridItem

Nilai Properti

A GridItem di PropertyGrid.

Contoh

Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan terjadinya PropertyGrid.PropertyValueChanged peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan. Untuk melaporkan beberapa peristiwa atau pada peristiwa yang sering terjadi, pertimbangkan untuk mengganti MessageBox.Show dengan Console.WriteLine atau menambahkan pesan ke multibaris TextBox.

Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis PropertyGrid bernama PropertyGrid1. Kemudian pastikan bahwa penanganan aktivitas dikaitkan dengan PropertyGrid.PropertyValueChanged peristiwa.

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

Berlaku untuk