DesignerActionPropertyItem クラス

定義

DesignerActionList から派生したクラス内のプロパティに関連付けられているパネル項目を表します。 このクラスは継承できません。

public ref class DesignerActionPropertyItem sealed : System::ComponentModel::Design::DesignerActionItem
public sealed class DesignerActionPropertyItem : System.ComponentModel.Design.DesignerActionItem
type DesignerActionPropertyItem = class
    inherit DesignerActionItem
Public NotInheritable Class DesignerActionPropertyItem
Inherits DesignerActionItem
継承
DesignerActionPropertyItem

次のコード例では、オブジェクトの DesignerActionItem コレクションを作成する方法を示します。 スマート タグを実装する完全な例については、「方法: スマート タグをWindows フォーム コンポーネントにアタッチする」を参照してください。

public override DesignerActionItemCollection GetSortedActionItems()
{
    DesignerActionItemCollection items = new DesignerActionItemCollection();

    //Define static section header entries.
    items.Add(new DesignerActionHeaderItem("Appearance"));
    items.Add(new DesignerActionHeaderItem("Information"));

    //Boolean property for locking color selections.
    items.Add(new DesignerActionPropertyItem("LockColors",
                     "Lock Colors", "Appearance",
                     "Locks the color properties."));
    if (!LockColors)
    {
        items.Add(new DesignerActionPropertyItem("BackColor",
                         "Back Color", "Appearance",
                         "Selects the background color."));
        items.Add(new DesignerActionPropertyItem("ForeColor",
                         "Fore Color", "Appearance",
                         "Selects the foreground color."));

        //This next method item is also added to the context menu 
        // (as a designer verb).
        items.Add(new DesignerActionMethodItem(this,
                         "InvertColors", "Invert Colors",
                         "Appearance",
                         "Inverts the fore and background colors.",
                          true));
    }
    items.Add(new DesignerActionPropertyItem("Text",
                     "Text String", "Appearance",
                     "Sets the display text."));

    //Create entries for static Information section.
    StringBuilder location = new StringBuilder("Location: ");
    location.Append(colLabel.Location);
    StringBuilder size = new StringBuilder("Size: ");
    size.Append(colLabel.Size);
    items.Add(new DesignerActionTextItem(location.ToString(),
                     "Information"));
    items.Add(new DesignerActionTextItem(size.ToString(),
                     "Information"));

    return items;
}
Public Overrides Function GetSortedActionItems() _
As DesignerActionItemCollection
    Dim items As New DesignerActionItemCollection()

    'Define static section header entries.
    items.Add(New DesignerActionHeaderItem("Appearance"))
    items.Add(New DesignerActionHeaderItem("Information"))

    'Boolean property for locking color selections.
    items.Add(New DesignerActionPropertyItem( _
    "LockColors", _
    "Lock Colors", _
    "Appearance", _
    "Locks the color properties."))

    If Not LockColors Then
        items.Add( _
        New DesignerActionPropertyItem( _
        "BackColor", _
        "Back Color", _
        "Appearance", _
        "Selects the background color."))

        items.Add( _
        New DesignerActionPropertyItem( _
        "ForeColor", _
        "Fore Color", _
        "Appearance", _
        "Selects the foreground color."))

        'This next method item is also added to the context menu 
        ' (as a designer verb).
        items.Add( _
        New DesignerActionMethodItem( _
        Me, _
        "InvertColors", _
        "Invert Colors", _
        "Appearance", _
        "Inverts the fore and background colors.", _
        True))
    End If
    items.Add( _
    New DesignerActionPropertyItem( _
    "Text", _
    "Text String", _
    "Appearance", _
    "Sets the display text."))

    'Create entries for static Information section.
    Dim location As New StringBuilder("Location: ")
    location.Append(colLabel.Location)
    Dim size As New StringBuilder("Size: ")
    size.Append(colLabel.Size)

    items.Add( _
    New DesignerActionTextItem( _
    location.ToString(), _
    "Information"))

    items.Add( _
    New DesignerActionTextItem( _
    size.ToString(), _
    "Information"))

    Return items
End Function

注釈

クラスは DesignerActionPropertyItem 、スマート タグ パネル内の個々の項目を表します。 各項目は、通常、 クラスから派生し、コンポーネント作成者によって提供されるクラスの DesignerActionList プロパティに関連付けられます。 関連付けは、 プロパティに格納されているプロパティの名前によって MemberName 維持されます。

個々のパネル項目は、クラスの メソッドの呼び出しによってパネルを GetSortedActionItems 形成するために一緒に DesignerActionList 関連付けられます。

関連付けられたプロパティの値を表示するには、そのプロパティにアクセサー メソッドが get 必要です。編集を許可するには、プロパティにアクセサー メソッドが set 必要です。 パネルでユーザーによるプロパティ項目の直接編集を許可する方法は、関連付けられたプロパティのデータ型に存在するサポート型情報によって異なります。 次の表は、可能性の高いスキームを示しています。

プロパティの種類の情報 プロパティ項目の編集ユーザー インターフェイス (UI)
関連付けられた型エディターがある (UITypeEditor) 基になるプロパティに関連付けられている型エディターが、プロパティの値を編集するために表示されます。
既知の型に関連付けられた型コンバーターがある (TypeConverter) プロパティの値を編集するために、既知の型の型エディターが表示されます。 たとえば、 の型コンバーター String では、 が表示される TextBox可能性があります。
ブール値 項目は、チェックマークなどのバイナリ UI を使用して表示されます。
上記のどれでもない。 項目は、データ型 ToString の メソッドを使用して編集できないテキスト文字列として表示されます。

などのすべての基本的な型と、 などのSystem.Boolean一般的な.NET Frameworkデータ型は、System.String標準の型コンバーターとエディターを提供します。 型コンバーターの詳細については、「方法: 型コンバーターまたは一般化された型変換を実装する」を参照してください。 型エディターの詳細については、「 方法: UI 型エディターを実装する」を参照してください。

コンストラクター

DesignerActionPropertyItem(String, String)

プロパティ名と表示名を指定して、DesignerActionPropertyItem クラスの新しいインスタンスを初期化します。

DesignerActionPropertyItem(String, String, String)

指定したプロパティ名とカテゴリ名、および表示テキストを使用して、DesignerActionPropertyItem クラスの新しいインスタンスを初期化します。

DesignerActionPropertyItem(String, String, String, String)

指定したプロパティ名とカテゴリ名、および表示テキストと説明テキストを使用して、DesignerActionPropertyItem クラスの新しいインスタンスを初期化します。

プロパティ

AllowAssociate

この項目を同じ Category プロパティ値を持つ項目のグループに配置できるかどうかを示す値を取得または設定します。

(継承元 DesignerActionItem)
Category

項目のグループ名を取得します。

(継承元 DesignerActionItem)
Description

項目の補足テキストを取得します。

(継承元 DesignerActionItem)
DisplayName

この項目のテキストを取得します。

(継承元 DesignerActionItem)
MemberName

この項目が関連付けられているプロパティの名前を取得します。

Properties

プログラマ定義のキーと値のペアを格納するために使用できるコレクションへの参照を取得します。

(継承元 DesignerActionItem)
RelatedComponent

現在のパネルに項目を提供するコンポーネントを取得または設定します。

ShowInSourceView

この項目がソース コード ビューに表示されるかどうかを示す値を取得または設定します。

(継承元 DesignerActionItem)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください