次の方法で共有


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 × 8 ピクセルであることが必要です。

handler
PropertyValueUIItemInvokeHandler

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

tooltip
String

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

例外

uiItemImage または handlernull です。

次のコード例では、 PropertyValueUIItem または VerticalMarginという名前HorizontalMarginのコンポーネントのプロパティの オブジェクトを提供します。 これらのプロパティの は 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"));
    }
}

適用対象

こちらもご覧ください