PropertyValueUIItemInvokeHandler Delegado

Definición

Representa el método que controlará el evento InvokeHandler de PropertyValueUIItem.Represents the method that will handle the InvokeHandler event of a PropertyValueUIItem.

public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext ^ context, PropertyDescriptor ^ descriptor, PropertyValueUIItem ^ invokedItem);
public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem);
type PropertyValueUIItemInvokeHandler = delegate of ITypeDescriptorContext * PropertyDescriptor * PropertyValueUIItem -> unit
Public Delegate Sub PropertyValueUIItemInvokeHandler(context As ITypeDescriptorContext, descriptor As PropertyDescriptor, invokedItem As PropertyValueUIItem)

Parámetros

context
ITypeDescriptorContext

ITypeDescriptorContext de la propiedad asociada al icono sobre el que se ha hecho doble clic.The ITypeDescriptorContext for the property associated with the icon that was double-clicked.

descriptor
PropertyDescriptor

Propiedad asociada al icono sobre el que se ha hecho doble clic.The property associated with the icon that was double-clicked.

invokedItem
PropertyValueUIItem

PropertyValueUIItem asociado al icono sobre el que se ha hecho doble clic.The PropertyValueUIItem associated with the icon that was double-clicked.

Ejemplos

En el ejemplo de código siguiente se proporciona un PropertyValueUIItem objeto para cualquier propiedad del componente denominado HorizontalMargin o VerticalMargin .The following code example provides a PropertyValueUIItem object for any properties of the component named HorizontalMargin or VerticalMargin. PropertyValueUIItemPara estas propiedades, proporciona una imagen, una información sobre herramientas y un controlador de eventos que muestra un cuadro de mensaje cuando se hace clic en la imagen de la propiedad.The PropertyValueUIItem for these properties provides an image, a ToolTip, and an event handler that displays a message box when the image for the property is clicked. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para la IPropertyValueUIService interfaz.This code example is part of a larger example provided for the IPropertyValueUIService interface.

// PropertyValueUIHandler delegate that provides PropertyValueUIItem
// objects to any properties named horizontalMargin or verticalMargin.
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 = DeserializeFromBase64Text( imageBlob1 );
      itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler( this, &PropertyUIComponent::marginInvoke ),"Test ToolTip" ) );
   }

   if ( propDesc->DisplayName->Equals( "verticalMargin" ) )
   {
      Image^ img = DeserializeFromBase64Text( imageBlob1 );
      img->RotateFlip( RotateFlipType::Rotate90FlipNone );
      itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler( this, &PropertyUIComponent::marginInvoke ),"Test ToolTip" ) );
   }
}
// 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 = DeserializeFromBase64Text(imageBlob1);
        itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
    }
    if( propDesc.DisplayName.Equals( "VerticalMargin" ) )
    {
        Image img = DeserializeFromBase64Text(imageBlob1);
        img.RotateFlip(RotateFlipType.Rotate90FlipNone);
        itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
    }
}
' PropertyValueUIHandler delegate that provides PropertyValueUIItem
' objects to any properties named HorizontalMargin or VerticalMargin.
Private Sub marginPropertyValueUIHandler(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal propDesc As System.ComponentModel.PropertyDescriptor, ByVal itemList As ArrayList)
    ' 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") Then
        Dim img As Image = DeserializeFromBase64Text(imageBlob1)
        itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
    End If
    If propDesc.DisplayName.Equals("VerticalMargin") Then
        Dim img As Image = DeserializeFromBase64Text(imageBlob1)
        img.RotateFlip(RotateFlipType.Rotate90FlipNone)
        itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
    End If
End Sub

Comentarios

Al hacer doble clic en un icono de la ventana Propiedades, se producirá el InvokeHandler evento del PropertyValueUIItem con el que está asociado el icono.Double-clicking an icon in the Properties window will raise the InvokeHandler event of the PropertyValueUIItem that the icon is associated with. InvokeHandlerNormalmente, el evento inicia una interfaz de usuario (UI) para editar el valor de la propiedad.The InvokeHandler event typically launches a user interface (UI) to edit the property's value. Agregue PropertyValueUIItemInvokeHandler a la InvokeHandler propiedad de un PropertyValueUIItem control para asignar un controlador de eventos que realice el comportamiento adecuado cuando se haga doble clic en el icono que se muestra al lado del nombre de la propiedad.Add a PropertyValueUIItemInvokeHandler to the InvokeHandler property of a PropertyValueUIItem to assign an event handler to perform the appropriate behavior when the icon displayed next to the property name is double-clicked.

Cuando se crea un delegado PropertyValueUIItemInvokeHandler, se identifica el método que controlará el evento.When you create a PropertyValueUIItemInvokeHandler delegate, you identify the method that will handle the event. Para asociar el evento al controlador, se debe agregar una instancia del delegado al evento.To associate the event with your event handler, add an instance of the delegate to the event. Siempre que se produce el evento, se llama a su controlador, a menos que se quite el delegado.The event handler is called whenever the event occurs, unless you remove the delegate. Para obtener más información sobre los delegados de controladores de eventos, vea controlar y provocar eventos.For more information about event-handler delegates, see Handling and Raising Events.

Métodos de extensión

GetMethodInfo(Delegate)

Obtiene un objeto que representa el método representado por el delegado especificado.Gets an object that represents the method represented by the specified delegate.

Se aplica a

Consulte también