語言

PropertyValueUIItem 類別

定義

提供 屬性視窗 中顯示的屬性資訊,包括相關的事件處理器、彈出資訊字串,以及該屬性要顯示的圖示。

public ref class PropertyValueUIItem
public class PropertyValueUIItem
type PropertyValueUIItem = class
Public Class PropertyValueUIItem
繼承
PropertyValueUIItem

範例

以下程式碼範例為元件中任何名為 PropertyValueUIItem 或 HorizontalMargin的屬性提供VerticalMargin物件。 PropertyValueUIItem for these properties 提供一張圖片、一個工具提示,以及一個事件處理程序,當點擊該屬性的圖片時會顯示訊息框。 此程式碼範例是介面更大 IPropertyValueUIService 範例的一部分。

// PropertyValueUIHandler delegate that provides PropertyValueUIItem
// objects to any properties named HorizontalMargin or VerticalMargin.
private void marginPropertyValueUIHandler(
    System.ComponentModel.ITypeDescriptorContext context,
    System.ComponentModel.PropertyDescriptor propDesc,
    ArrayList itemList)
{
    // A PropertyValueUIHandler added to the IPropertyValueUIService
    // is queried once for each property of a component and passed
    // a PropertyDescriptor that represents the characteristics of 
    // the property when the Properties window is set to a new 
    // component. A PropertyValueUIHandler can determine whether 
    // to add a PropertyValueUIItem for the object to its ValueUIItem 
    // list depending on the values of the PropertyDescriptor.
    if (propDesc.DisplayName.Equals("HorizontalMargin"))
    {
        Image img = Image.FromFile("SampImag.jpg");
        itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
    }
    if (propDesc.DisplayName.Equals("VerticalMargin"))
    {
        Image img = Image.FromFile("SampImag.jpg");
        img.RotateFlip(RotateFlipType.Rotate90FlipNone);
        itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
    }
}

建構函式

名稱 Description
PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String)

初始化 PropertyValueUIItem 類別的新執行個體。

屬性

名稱 Description
Image

會取得 8 x 8 像素的影像,會在 屬性視窗 中繪製。

InvokeHandler

當使用者雙擊此項目時,會顯示出的處理器。

ToolTip

取得或設定該項目顯示的資訊串。

方法

名稱 Description
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
Reset()

重置使用者介面(UI)項目。

ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於

另請參閱