방법: 기존 키 바인딩 보기

Visual Studio의 추가 기능은 Visual Studio 2013에서 사용되지 않습니다. 추가 기능을 VSPackage 확장으로 업그레이드하는 것이 좋습니다. 업그레이드에 대한 자세한 내용은 FAQ: VSPackage 확장으로 추가 기능 변환 을 참조하십시오.

Bindings 속성을 사용하면 지정된 명령과 연결되어 있는 키 바인딩을 보거나 변경할 수 있습니다. 이 속성을 읽으면 명령의 현재 바인딩을 개체 배열로 가져올 수 있습니다. 각 개체에는 바인딩을 설명하는 문자열이 들어 있습니다.

Bindings 속성에 대한 값을 설정하면 지정된 명령에 하나 이상의 새로운 키 바인딩이 할당됩니다. 자세한 내용은 방법: 단일 바로 가기 키에 명령 바인딩방법: 여러 바로 가기 키에 명령 바인딩를 참조하십시오.

참고

표시되는 대화 상자와 메뉴 명령은 활성 설정이나 버전에 따라 도움말에서 설명하는 것과 다를 수 있습니다.이러한 절차는 일반 개발 설정을 사용하여 개발되었습니다.설정을 변경하려면 도구 메뉴에서 설정 가져오기 및 내보내기를 선택합니다.자세한 내용은 Visual Studio에서 개발 설정 사용자 지정을 참조하십시오.

기존의 키 바인딩 보기

  1. 추가 기능을 만듭니다.

    Visual Studio 추가 기능 마법사를 사용하는 방법에 대한 자세한 내용은 방법: 추가 기능 만들기를 참조하십시오.

  2. Connect 클래스에 대한 using (또는 Imports) 명령어에 System.Windows.Forms에 대한 참조를 추가하고 이 네임스페이스를 추가

  3. Connect 클래스의 코드에 다음 함수를 붙여넣습니다.

  4. 추가 기능을 실행하려면 도구 메뉴에서 추가 기능 관리자를 클릭하고 방금 만든 추가 기능을 선택한 다음 확인을 클릭합니다.

    메시지 상자는 File.NewFile 명령에 바인딩된 바로 가기 키의 전체 목록을 표시합니다.

예제

다음 예제에서는 File.NewFile 명령에 바인딩된 모든 바로 가기 키를 표시하여 Bindings를 사용하는 방법을 보여 줍니다.

Public Sub OnConnection(ByVal application As Object, ByVal _
  connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef _
  custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ' Pass the applicationObject member variable to the code example.
    ListKeyBindings(_applicationObject)
End Sub

Sub ListKeyBindings(ByVal dte As DTE2)
    ' Bindings() is an array of key binding string names.
    Dim bindings() As Object
    Dim binding As Object
    Dim msg As String = Nothing
    ' Populate the collection with all of the bindings
    ' for the command File.NewFile.
    bindings = dte.Commands.Item("File.NewFile").Bindings
    For Each binding In bindings
        msg += CStr(binding) & vbCr
    Next
    MsgBox(msg)
 End Sub
// Add-in code.
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst, ref
 System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;

    //Pass the applicationObject member variable to the code example.
    ListKeyBindings((DTE2)_applicationObject);
}
public void ListKeyBindings(DTE2 dte)
{
    object[] bindings;
    string msg = string.Empty;
    // Populate the collection with all of the bindings associated
    // with the command File.NewFile.
    // Bindings() is an array of key binding string names.
    bindings = (object[])dte.Commands.Item("File.NewFile", 0).Bindings;
    foreach (object b in bindings)
    {
        msg += ((string)b) + "\n";
    }
    System.Windows.Forms.MessageBox.Show(msg);
}

참고 항목

작업

방법: 기존 바로 가기 키 유지

개념

Bindings 속성 매개 변수 형식

기타 리소스

추가 기능 명령을 키에 바인딩