次の方法で共有


PropertyValueUIHandler デリゲート

IPropertyValueUIService の実装にデリゲートを追加するメソッドを表します。

<Serializable>
Public Delegate Sub PropertyValueUIHandler( _   ByVal context As ITypeDescriptorContext, _   ByVal propDesc As PropertyDescriptor, _   ByVal valueUIItemList As ArrayList _)
[C#]
[Serializable]
public delegate void PropertyValueUIHandler(   ITypeDescriptorContext context,   PropertyDescriptor propDesc,   ArrayList valueUIItemList);
[C++]
[Serializable]
public __gc __delegate void PropertyValueUIHandler(   ITypeDescriptorContext* context,   PropertyDescriptor* propDesc,   ArrayList* valueUIItemList);

[JScript] JScript では、.NET Framework のデリゲートを利用することができます。ただし、独自に定義することはできません。

パラメータ [Visual Basic, C#, C++]

コールバック メソッドの宣言のパラメータは、PropertyValueUIHandler デリゲートの宣言と同じでなければなりません。

解説

このデリゲートが呼び出されると、指定されたプロパティに対する UI 項目を含む PropertyValueUIItem を、 valueUIItemList パラメータとして渡された ArrayList に追加します。

使用例

[Visual Basic, C#, C++] 次に示すのは、 HorizontalMargin または VerticalMargin という名前のすべてのプロパティに対して PropertyValueUIItem オブジェクトを提供する PropertyValueUIHandler イベント ハンドラ メソッドを作成するコード例です。

 
' PropertyValueUIHandler delegate that provides PropertyValueUIItem
' objects to any properties named HorizontalMargin or VerticalMargin.
Private Sub marginPropertyValueUIHandler(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal propDesc As System.ComponentModel.PropertyDescriptor, ByVal itemList As ArrayList)
    ' 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") Then
        Dim img As Image = DeserializeFromBase64Text(imageBlob1)
        itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
    End If
    If propDesc.DisplayName.Equals("VerticalMargin") Then
        Dim img As Image = DeserializeFromBase64Text(imageBlob1)
        img.RotateFlip(RotateFlipType.Rotate90FlipNone)
        itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
    End If
End Sub

[C#] 
// 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 = DeserializeFromBase64Text(imageBlob1);
        itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
    }
    if( propDesc.DisplayName.Equals( "VerticalMargin" ) )
    {
        Image img = DeserializeFromBase64Text(imageBlob1);
        img.RotateFlip(RotateFlipType.Rotate90FlipNone);
        itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
    }
}

[C++] 
// 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(S"horizontalMargin")) {
      Image* img = DeserializeFromBase64Text(imageBlob1);
      itemList->Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this, &PropertyUIComponent::marginInvoke), S"Test ToolTip"));
   }
   if (propDesc->DisplayName->Equals(S"verticalMargin")) {
      Image* img = DeserializeFromBase64Text(imageBlob1);
      img->RotateFlip(RotateFlipType::Rotate90FlipNone);
      itemList->Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this, &PropertyUIComponent::marginInvoke), S"Test ToolTip"));
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Drawing.Design

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Drawing (System.Drawing.dll 内)

参照

System.Drawing.Design 名前空間 | IPropertyValueUIService | PropertyValueUIItem