次の方法で共有


DesignerActionItem クラス

定義

スマート タグ パネル上のパネル項目を表す型の基本クラスを提供します。

public ref class DesignerActionItem abstract
public abstract class DesignerActionItem
type DesignerActionItem = class
Public MustInherit Class DesignerActionItem
継承
DesignerActionItem
派生

次のコード例では、DesignerActionItem オブジェクトのコレクションを作成する方法を示します。

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

注釈

DesignerActionItem クラスは、スマート タグ パネル内の個々のパネル項目を表すクラスの抽象基本として機能します。これは、スマート タグのメニューのようなユーザー インターフェイス (UI) を表します。 .NET Framework には、テキスト形式、ヘッダー テキスト、関連付けられている DesignerActionList クラスのプロパティとメソッド、デザイナー動詞など、スマート タグ パネルのさまざまな一般的なエントリを表す派生クラスが用意されています。

通常、 DesignerAction 機能は、 DesignerActionListから派生したプログラマ提供のクラスで定義されます。このクラスには、個々のパネル項目をグループ化してスマート タグ パネルを形成する GetSortedActionItems メソッドが含まれています。 DesignerActionPropertyItem型とDesignerActionMethodItem型は、DesignerActionListから派生したクラスのメンバーに関連付けられます。DesignerActionMethodItem オブジェクトは、関連付けられたパネル エントリがユーザーによって選択されるとアクティブになります。

フォームとダイアログ ボックスは、 DesignerActionListから派生したクラスのメンバーによって表示できます。 既定では、これらのウィンドウの親はスマート タグ パネルのコンテナー ウィンドウになります。 これらの子ウィンドウを別のサービスまたはウィンドウに明示的に親にすると、項目が正しく表示されないことがあります。

コンストラクター

名前 説明
DesignerActionItem(String, String, String)

DesignerActionItem クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AllowAssociate

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

Category

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

Description

アイテムの補足テキストを取得します。

DisplayName

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

Properties

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

ShowInSourceView

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

メソッド

名前 説明
Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

適用対象

こちらもご覧ください