Freigeben über


PropertyValueUIItemInvokeHandler-Delegat

Stellt die Methode dar, die das InvokeHandler-Ereignis von PropertyValueUIItem behandelt.

Namespace: System.Drawing.Design
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Delegate Sub PropertyValueUIItemInvokeHandler ( _
    context As ITypeDescriptorContext, _
    descriptor As PropertyDescriptor, _
    invokedItem As PropertyValueUIItem _
)
'Usage
Dim instance As New PropertyValueUIItemInvokeHandler(AddressOf HandlerMethod)
public delegate void PropertyValueUIItemInvokeHandler (
    ITypeDescriptorContext context,
    PropertyDescriptor descriptor,
    PropertyValueUIItem invokedItem
)
public delegate void PropertyValueUIItemInvokeHandler (
    ITypeDescriptorContext^ context, 
    PropertyDescriptor^ descriptor, 
    PropertyValueUIItem^ invokedItem
)
/** @delegate */
public delegate void PropertyValueUIItemInvokeHandler (
    ITypeDescriptorContext context, 
    PropertyDescriptor descriptor, 
    PropertyValueUIItem invokedItem
)
JScript unterstützt die Verwendung von Delegaten, aber nicht die Deklaration von neuen Delegaten.

Parameter

  • context
    Der ITypeDescriptorContext für die Eigenschaft, die dem Symbol zugeordnet ist, auf das doppelgeklickt wurde.
  • descriptor
    Die Eigenschaft, die dem Symbol zugeordnet ist, auf das doppelgeklickt wurde.
  • invokedItem
    Das PropertyValueUIItem, das dem Symbol zugeordnet ist, auf das doppelgeklickt wurde.

Hinweise

Durch Doppelklicken auf ein Symbol im Eigenschaftenfenster wird das InvokeHandler-Ereignis des PropertyValueUIItem ausgelöst, dem das Symbol zugeordnet ist. Das InvokeHandler-Ereignis startet normalerweise eine Benutzeroberfläche für die Bearbeitung des Eigenschaftenwerts. Fügen Sie der InvokeHandler-Eigenschaft eines PropertyValueUIItem einen PropertyValueUIItemInvokeHandler für die Zuweisung eines Ereignishandlers hinzu, damit bei einem Doppelklick auf das neben dem Eigenschaftennamen angezeigte Symbol das entsprechende Verhalten ausgeführt wird.

Beim Erstellen eines PropertyValueUIItemInvokeHandler-Delegaten bestimmen Sie die Methode für die Ereignisbehandlung. Um dem Ereignishandler das Ereignis zuzuordnen, fügen Sie dem Ereignis eine Instanz des Delegaten hinzu. Der Ereignishandler wird bei jedem Eintreten des Ereignisses aufgerufen, sofern der Delegat nicht entfernt wird. Weitere Informationen über Ereignishandlerdelegaten finden Sie unter Ereignisse und Delegaten.

Beispiel

Das folgende Codebeispiel stellt für alle Eigenschaften der Komponente HorizontalMargin oder VerticalMargin ein PropertyValueUIItem-Objekt bereit. PropertyValueUIItem für diese Eigenschaften stellt ein Bild, eine QuickInfo und einen Ereignishandler bereit, in dem beim Klicken auf das Bild für die Eigenschaft ein Meldungsfeld angezeigt wird. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IPropertyValueUIService-Schnittstelle.

' 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
// 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.
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.get_DisplayName().Equals("HorizontalMargin")) {
        Image img = DeserializeFromBase64Text(imageBlob1);

        itemList.Add(new PropertyValueUIItem(img, 
            new PropertyValueUIItemInvokeHandler(this.MarginInvoke),
            "Test ToolTip"));
    }
    if (propDesc.get_DisplayName().Equals("VerticalMargin")) {
        Image img = DeserializeFromBase64Text(imageBlob1);

        img.RotateFlip(RotateFlipType.Rotate90FlipNone);
        itemList.Add(new PropertyValueUIItem(img, 
            new PropertyValueUIItemInvokeHandler(this.MarginInvoke),
            "Test ToolTip"));
    }
} //MarginPropertyValueUIHandler

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

System.Drawing.Design-Namespace
ITypeDescriptorContext
PropertyValueUIItem-Klasse
IPropertyValueUIService-Schnittstelle