Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

PropertyValueUIHandler Delegate

Represents the method that adds a delegate to an implementation of IPropertyValueUIService.

[Visual Basic]
<Serializable>
Public Delegate Sub PropertyValueUIHandler( _
   ByVal context As ITypeDescriptorContext, _
   ByVal propDesc As PropertyDescriptor, _
   ByVal valueUIItemList As ArrayList _
)
[C#]
[Serializable]
public delegate void PropertyValueUIHandler(
   ITypeDescriptorContext context,
   PropertyDescriptor propDesc,
   ArrayList valueUIItemList
);
[C++]
[Serializable]
public __gc __delegate void PropertyValueUIHandler(
   ITypeDescriptorContext* context,
   PropertyDescriptor* propDesc,
   ArrayList* valueUIItemList
);

[JScript] In JScript, you can use the delegates in the .NET Framework, but you cannot define your own.

Parameters [Visual Basic, C#, C++]

The declaration of your callback method must have the same parameters as the PropertyValueUIHandler delegate declaration.

context
An ITypeDescriptorContext that can be used to obtain context information.
propDesc
A PropertyDescriptor that represents the property being queried.
valueUIItemList
An ArrayList of PropertyValueUIItem objects containing the UI items associated with the property.

Remarks

When this delegate is invoked, it can add a PropertyValueUIItem containing UI items for the specified property to the ArrayList passed as the valueUIItemList parameter.

Example

[Visual Basic, C#, C++] This following code example demonstrates creating a PropertyValueUIHandler event handler method that provides PropertyValueUIItem objects for any properties named HorizontalMargin or VerticalMargin.

[Visual Basic] 
' 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

[C#] 
// 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") );
    }
}

[C++] 
// 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(S"horizontalMargin")) {
      Image* img = DeserializeFromBase64Text(imageBlob1);
      itemList->Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this, &PropertyUIComponent::marginInvoke), S"Test ToolTip"));
   }
   if (propDesc->DisplayName->Equals(S"verticalMargin")) {
      Image* img = DeserializeFromBase64Text(imageBlob1);
      img->RotateFlip(RotateFlipType::Rotate90FlipNone);
      itemList->Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this, &PropertyUIComponent::marginInvoke), S"Test ToolTip"));
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Drawing.Design

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Drawing (in System.Drawing.dll)

See Also

System.Drawing.Design Namespace | IPropertyValueUIService | PropertyValueUIItem

Show:
© 2015 Microsoft