PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) Constructor

Definition

Initializes a new instance of the PropertyValueUIItem class.

public:
 PropertyValueUIItem(System::Drawing::Image ^ uiItemImage, System::Drawing::Design::PropertyValueUIItemInvokeHandler ^ handler, System::String ^ tooltip);
public PropertyValueUIItem (System.Drawing.Image uiItemImage, System.Drawing.Design.PropertyValueUIItemInvokeHandler handler, string tooltip);
public PropertyValueUIItem (System.Drawing.Image uiItemImage, System.Drawing.Design.PropertyValueUIItemInvokeHandler handler, string? tooltip);
new System.Drawing.Design.PropertyValueUIItem : System.Drawing.Image * System.Drawing.Design.PropertyValueUIItemInvokeHandler * string -> System.Drawing.Design.PropertyValueUIItem
Public Sub New (uiItemImage As Image, handler As PropertyValueUIItemInvokeHandler, tooltip As String)

Parameters

uiItemImage
Image

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

handler
PropertyValueUIItemInvokeHandler

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

tooltip
String

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

Exceptions

uiItemImage or handler is null.

Examples

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.
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"));
    }
}

Applies to

See also