PropertyValueUIHandler Delegasikan

Definisi

Mewakili metode yang menambahkan delegasi ke implementasi IPropertyValueUIService.

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)

Parameter

context
ITypeDescriptorContext

Yang ITypeDescriptorContext dapat digunakan untuk mendapatkan informasi konteks.

propDesc
PropertyDescriptor

PropertyDescriptor yang mewakili properti yang sedang dikueri.

valueUIItemList
ArrayList

Objek ArrayListPropertyValueUIItem yang berisi item UI yang terkait dengan properti .

Contoh

Contoh kode berikut ini menunjukkan pembuatan PropertyValueUIHandler metode penanganan aktivitas yang menyediakan PropertyValueUIItem objek untuk properti apa pun bernama HorizontalMargin atau VerticalMargin.

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

Keterangan

Ketika delegasi ini dipanggil, delegasi ini dapat menambahkan item UI yang PropertyValueUIItem berisi untuk properti yang ditentukan ke yang ArrayList diteruskan sebagai valueUIItemList parameter.

Metode Ekstensi

GetMethodInfo(Delegate)

Mendapatkan objek yang mewakili metode yang diwakili oleh delegasi yang ditentukan.

Berlaku untuk

Lihat juga