PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) Constructeur

Définition

Initialise une nouvelle instance de la classe PropertyValueUIItem.

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)

Paramètres

uiItemImage
Image

Icône à afficher. Il doit s'agir d'une image 8 x 8 pixels.

handler
PropertyValueUIItemInvokeHandler

Gestionnaire à appeler lorsque l'utilisateur double-clique sur l'image.

tooltip
String

ToolTip à afficher pour la propriété à laquelle ce PropertyValueUIItem est associé.

Exceptions

uiItemImage ou handler est null.

Exemples

L’exemple de code suivant fournit un PropertyValueUIItem objet pour toutes les propriétés du composant nommé HorizontalMargin ou VerticalMargin. Le PropertyValueUIItem pour ces propriétés fournit une image, une info-bulle et un gestionnaire d’événements qui affiche une boîte de message lorsque l’utilisateur clique sur l’image de la propriété. Cet exemple de code fait partie d’un exemple plus grand fourni pour l’interface IPropertyValueUIService .

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

S’applique à

Voir aussi