Commands インターフェイス

環境のすべてのコマンドが、Command オブジェクトとして含まれています。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
<GuidAttribute("E6B96CAC-B8C7-40AE-B705-5C81878C4A9E")> _
Public Interface Commands _
    Inherits IEnumerable
[GuidAttribute("E6B96CAC-B8C7-40AE-B705-5C81878C4A9E")]
public interface Commands : IEnumerable
[GuidAttribute(L"E6B96CAC-B8C7-40AE-B705-5C81878C4A9E")]
public interface class Commands : IEnumerable
[<GuidAttribute("E6B96CAC-B8C7-40AE-B705-5C81878C4A9E")>]
type Commands =  
    interface
        interface IEnumerable
    end
public interface Commands extends IEnumerable

Commands 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Count Commands コレクション内のオブジェクトの数を示す値を取得します。
パブリック プロパティ DTE トップレベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Parent Commands コレクションのすぐ上の親オブジェクトを取得します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド Add インフラストラクチャ。 マイクロソフト内部でのみ使用。
パブリック メソッド AddCommandBar コマンド バーを作成します。このコマンド バーは保存され、次に環境を起動したときに使用できます。
パブリック メソッド AddNamedCommand 名前付きコマンドを作成します。この名前付きコマンドは環境によって保存され、次に環境を起動したときにアドインが読み込まれない場合でも使用できます。
パブリック メソッド CommandInfo 指定した Microsoft.VisualStudio.CommandBars.CommandBar コントロールに関連付けられているコマンドの GUID と ID を返します。
パブリック メソッド GetEnumerator() コレクションを反復処理する列挙子を返します。 (IEnumerable から継承されます。)
パブリック メソッド GetEnumerator() Commands コレクション内の項目の列挙子を返します。
パブリック メソッド Item インデックス付き Command オブジェクトを返します。
パブリック メソッド Raise 指定したコマンドを実行します。
パブリック メソッド RemoveCommandBar AddCommandBar メソッドで作成したコマンド バーを削除します。

このページのトップへ

Imports Microsoft.VisualStudio.CommandBars
Sub CommandsExample()
   ' Before running, you must add a reference to the Office 
   ' typelib to gain access to the CommandBar object.
   Dim cmds As Commands
   Dim cmdobj As Command
   Dim customin, customout As Object
   Dim cmdbarobj As CommandBar
   Dim colAddins As AddIns

   ' Set references.
   colAddins = DTE.AddIns()
   cmds = DTE.Commands
   cmdobj = cmds.Item("File.NewFile")

   ' Execute the File.NewFile command.
   cmds.Raise(cmdobj.Guid, cmdobj.ID, customin, customout)

   ' Create a toolbar and add the File.NewFile command to it.
   cmdobj = cmds.Item("File.NewFile")
   cmdbarobj = cmds.AddCommandBar("Mycmdbar", _
     vsCommandBarType.vsCommandBarTypeToolbar)
   cmdobj.AddControl(cmdbarobj)
   ' Show the command bar and its button.
   cmdbarobj.Visible = True
End Sub

参照

参照

EnvDTE 名前空間