言語

PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) コンストラクター

定義

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)

パラメーター

uiItemImage
Image

表示するアイコン。 イメージは 8 x 8 ピクセルである必要があります。

handler
PropertyValueUIItemInvokeHandler

イメージがダブルクリックされたときに呼び出すハンドラー。

tooltip
String

このToolTipが関連付けられているプロパティに対して表示するPropertyValueUIItem

例外

uiItemImage または handlernull

次のコード例では、PropertyValueUIItem または HorizontalMargin という名前のコンポーネントのプロパティに対してVerticalMargin オブジェクトを提供します。 これらのプロパティの PropertyValueUIItem は、イメージ、ツールヒント、およびプロパティのイメージがクリックされたときにメッセージ ボックスを表示するイベント ハンドラーを提供します。 このコード例は、 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"));
    }
}

適用対象

こちらもご覧ください