PropertyValueUIHandler 代理人

定義

表示將委派 (Delegate) 加入 IPropertyValueUIService 實作 (Implementation) 的方法。

public delegate void PropertyValueUIHandler(ITypeDescriptorContext ^ context, PropertyDescriptor ^ propDesc, ArrayList ^ valueUIItemList);
public delegate void PropertyValueUIHandler(ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
type PropertyValueUIHandler = delegate of ITypeDescriptorContext * PropertyDescriptor * ArrayList -> unit
Public Delegate Sub PropertyValueUIHandler(context As ITypeDescriptorContext, propDesc As PropertyDescriptor, valueUIItemList As ArrayList)

參數

context
ITypeDescriptorContext

ITypeDescriptorContext,可用來取得內容資訊。

propDesc
PropertyDescriptor

PropertyDescriptor,表示正在接受查詢的屬性。

valueUIItemList
ArrayList

ArrayList 物件的 PropertyValueUIItem,含有與屬性相關的 UI 項目。

範例

下列程式碼範例示範如何 PropertyValueUIHandler 建立事件處理常式方法,為任何名為 HorizontalMarginVerticalMargin 的屬性提供 PropertyValueUIItem 物件。

// 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"));
    }
}

備註

叫用此委派時,它可以將包含指定屬性 ArrayList 的 UI 專案加入 PropertyValueUIItem 傳遞為 參數的 valueUIItemList

擴充方法

GetMethodInfo(Delegate)

取得表示特定委派所代表之方法的物件。

適用於

另請參閱