PropertyValueUIHandler Delegato

Definizione

Rappresenta il metodo che aggiunge un delegato a un'implementazione di 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)

Parametri

context
ITypeDescriptorContext

Un oggetto ITypeDescriptorContext che può essere utilizzato per ottenere informazioni sul contesto.

propDesc
PropertyDescriptor

Un oggetto PropertyDescriptor che rappresenta la proprietà richiesta.

valueUIItemList
ArrayList

ArrayList di oggetti PropertyValueUIItem contenenti gli elementi dell'interfaccia utente associati alla proprietà.

Esempio

Questo esempio di codice seguente illustra la creazione di un PropertyValueUIHandler metodo del gestore eventi che fornisce PropertyValueUIItem oggetti per le proprietà denominate HorizontalMargin o 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"));
    }
}

Commenti

Quando viene richiamato questo delegato, può aggiungere un PropertyValueUIItem oggetto contenente elementi dell'interfaccia utente per la proprietà specificata al ArrayList passato come valueUIItemList parametro.

Metodi di estensione

GetMethodInfo(Delegate)

Ottiene un oggetto che rappresenta il metodo rappresentato dal delegato specificato.

Si applica a

Vedi anche