Command.AddControl 메서드

명령에 대한 영구 명령 모음 컨트롤을 만듭니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Function AddControl ( _
    Owner As Object, _
    Position As Integer _
) As Object
Object AddControl(
    Object Owner,
    int Position
)
Object^ AddControl(
    [InAttribute] Object^ Owner, 
    [InAttribute] int Position
)
abstract AddControl : 
        Owner:Object * 
        Position:int -> Object
function AddControl(
    Owner : Object, 
    Position : int
) : Object

매개 변수

  • Owner
    형식: Object

    필수 요소. 새 명령 모음 컨트롤이 추가될 CommandBar 개체입니다.

  • Position
    형식: Int32

    선택 사항입니다. 명령 모음에서 1부터 시작하는 새 컨트롤을 배치할 인덱스 위치입니다.

반환 값

형식: Object
CommandBarControl 개체

설명

컨트롤 및 해당 위치, 명령에 따라 사용할 수 있도록 환경 저장 ContextUIGUIDs 기여는 추가 기능을 로드 하지 하면 나에 대 한 응답에는 QueryStatus Method 로드 되 면.

예제

Imports Microsoft.Office.Core
Sub AddControlExample()
   ' Before running, you must add a reference to
   ' Microsoft.VisualStudio.CommandBars. Also, 
   ' for this example to work correctly, there should be an add-in 
   ' available in the Visual Studio environment.
   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")

   ' Create a toolbar and add the File.NewFile command to it.
   cmdbarobj = cmds.AddCommandBar("MyCmdBar", vsCommandBarType.vsCommandBarTypeToolbar)
   MsgBox("Commandbar name: " & cmdbarobj.Name)
   cmdobj.AddControl(cmdbarobj)
   cmds.AddNamedCommand(colAddins.Item(1), "MyCommand", "Button Text", "Some tooltip", True)
End Sub

.NET Framework 보안

참고 항목

참조

Command 인터페이스

EnvDTE 네임스페이스