PropertyValueChangedEventArgs 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public ref class PropertyValueChangedEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class PropertyValueChangedEventArgs : EventArgs
public class PropertyValueChangedEventArgs : EventArgs
[<System.Runtime.InteropServices.ComVisible(true)>]
type PropertyValueChangedEventArgs = class
inherit EventArgs
type PropertyValueChangedEventArgs = class
inherit EventArgs
Public Class PropertyValueChangedEventArgs
Inherits EventArgs
- 繼承
- 屬性
範例
下列程式代碼範例示範此類型的用法。 在這個例子中,事件處理者會回報事件 PropertyValueChanged 的發生情況。 此報告能幫助您了解事件發生時間,並協助除錯。 若要報告多個事件或頻繁發生的事件,請考慮將Show訊息替換Console.WriteLine為或附加於多行TextBox。
要執行範例程式碼,請將其貼到包含一個 PropertyGrid 名為 PropertyGrid1的實例的專案中。 然後確保事件處理程式與事件 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
備註
PropertyValueChanged當使用者更改屬性的值時,該屬性在 中指定GridItem為 ,PropertyGrid即 。
如需處理事件的詳細資訊,請參閱 處理和引發事件。
建構函式
| 名稱 | Description |
|---|---|
| PropertyValueChangedEventArgs(GridItem, Object) |
初始化 PropertyValueChangedEventArgs 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| ChangedItem |
知道 GridItem 那個被改了。 |
| OldValue |
格子項目在被更改前的價值。 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |