Language

PropertyValueUIItemInvokeHandler 代理人

定義

InvokeHandlerのPropertyValueUIItem イベントを処理するメソッドを表します。

public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext ^ context, PropertyDescriptor ^ descriptor, PropertyValueUIItem ^ invokedItem);
public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem);
type PropertyValueUIItemInvokeHandler = delegate of ITypeDescriptorContext * PropertyDescriptor * PropertyValueUIItem -> unit
Public Delegate Sub PropertyValueUIItemInvokeHandler(context As ITypeDescriptorContext, descriptor As PropertyDescriptor, invokedItem As PropertyValueUIItem)

パラメーター

context
ITypeDescriptorContext

ダブルクリックされたアイコンに関連付けられたプロパティの ITypeDescriptorContext 。

descriptor
PropertyDescriptor

ダブルクリックされたアイコンに関連付けられているプロパティ。

invokedItem
PropertyValueUIItem

ダブルクリックされたアイコンに関連付けられている PropertyValueUIItem 。

例

次のコード例では、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"));
    }
}

注釈

[プロパティ] ウィンドウでアイコンをダブルクリックすると、アイコンが関連付けられているInvokeHandlerのPropertyValueUIItem イベントが発生します。 InvokeHandler イベントは、通常、プロパティの値を編集するためのユーザー インターフェイス (UI) を起動します。 PropertyValueUIItemInvokeHandlerのInvokeHandler プロパティにPropertyValueUIItemを追加して、プロパティ名の横に表示されるアイコンがダブルクリックされたときに適切な動作を実行するイベント ハンドラーを割り当てます。

PropertyValueUIItemInvokeHandler デリゲートを作成するときは、イベントを処理するメソッドを識別します。 イベントをイベント ハンドラーに関連付けるには、デリゲートのインスタンスをイベントに追加します。 デリゲートを削除しない限り、イベントが発生するたびにイベント ハンドラーが呼び出されます。 イベント ハンドラー デリゲートの詳細については、「イベントの 処理と発生」を参照してください。

拡張メソッド

名前 説明
GetMethodInfo(Delegate)

指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。

適用対象

こちらもご覧ください