Bewerken

Share via


PropertyValueUIItem Class

Definition

Provides information about a property displayed in the Properties window, including the associated event handler, pop-up information string, and the icon to display for the property.

public ref class PropertyValueUIItem
public class PropertyValueUIItem
type PropertyValueUIItem = class
Public Class PropertyValueUIItem
Inheritance
PropertyValueUIItem

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

Constructors

PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String)

Initializes a new instance of the PropertyValueUIItem class.

Properties

Image

Gets the 8 x 8 pixel image that will be drawn in the Properties window.

InvokeHandler

Gets the handler that is raised when a user double-clicks this item.

ToolTip

Gets or sets the information string to display for this item.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Reset()

Resets the user interface (UI) item.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also