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 형식에서는 다음과 같은 멤버를 노출합니다.

속성

  이름 설명
Public 속성 Count Commands 컬렉션의 개체 수를 나타내는 값을 가져옵니다.
Public 속성 DTE 최상위 확장성 개체를 가져옵니다.
Public 속성 Parent Commands 컬렉션의 직계 개체를 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 Add 인프라입니다. Microsoft 내부 전용입니다.
Public 메서드 AddCommandBar 저장되어 다음에 환경을 시작하면 사용할 수 있는 명령 모음을 만듭니다.
Public 메서드 AddNamedCommand 환경에 저장되어 다음에 환경을 시작하면 사용할 수 있는 명명된 명령을 만듭니다. 이 명령은 환경을 시작할 때 추가 기능을 로드하지 않아도 사용할 수 있습니다.
Public 메서드 CommandInfo 지정된 Microsoft.VisualStudio.CommandBars.CommandBar 컨트롤에 연결된 명령 GUID 및 ID를 반환합니다.
Public 메서드 GetEnumerator() 컬렉션을 반복하는 열거자를 반환합니다. (IEnumerable에서 상속됨)
Public 메서드 GetEnumerator() Commands 컬렉션의 항목에 대한 열거자를 반환합니다.
Public 메서드 Item 인덱싱된 Command 개체를 반환합니다.
Public 메서드 Raise 지정된 명령을 실행합니다.
Public 메서드 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 네임스페이스