PropertyValueUIItem Constructor (Image^, PropertyValueUIItemInvokeHandler^, String^)

 

Initializes a new instance of the PropertyValueUIItem class.

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

public:
PropertyValueUIItem(
	Image^ uiItemImage,
	PropertyValueUIItemInvokeHandler^ handler,
	String^ tooltip
)

Parameters

uiItemImage
Type: System.Drawing::Image^

The icon to display. The image must be 8 x 8 pixels.

handler
Type: System.Drawing.Design::PropertyValueUIItemInvokeHandler^

The handler to invoke when the image is double-clicked.

tooltip
Type: System::String^

The ToolTip to display for the property that this PropertyValueUIItem is associated with.

Exception Condition
ArgumentNullException

uiItemImage or handler is null.

The following code example provides a PropertyValueUIItem object for any properties of the component named HorizontalMargin or VerticalMargin. 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. 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" ) );
   }
}

.NET Framework
Available since 1.1
Return to top
Show: