PropertyGrid.PropertyValueChanged Evento

Definição

Ocorre quando o valor de uma propriedade muda.

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 

Tipo de Evento

Exemplos

O seguinte exemplo de código demonstra a utilização deste elemento. No exemplo, um gestor de eventos reporta a ocorrência do PropertyValueChanged evento. Este relatório ajuda-o a saber quando o evento ocorre e pode ajudá-lo na depuração. Para reportar múltiplos eventos ou eventos que ocorrem frequentemente, considere substituir MessageBox.Show ou Console.WriteLine anexar a mensagem a uma multilinha TextBox.

Para executar o código de exemplo, cole-o num projeto que contenha uma instância do tipo PropertyGrid chamada PropertyGrid1. Depois, certifique-se de que o gestor de eventos está associado ao PropertyValueChanged evento.

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

Observações

Para obter mais informações sobre como manipular eventos, consulte Manipulando e gerando eventos.

Aplica-se a