Command.Bindings 속성

업데이트: 2007년 11월

명령을 호출하는 데 사용되는 키 입력 목록을 가져오거나 설정합니다.

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

구문

Property Bindings As Object

Dim instance As Command
Dim value As Object

value = instance.Bindings

instance.Bindings = value
Object Bindings { get; set; }
property Object^ Bindings {
    Object^ get ();
    void set (Object^ value);
}
function get Bindings () : Object
function set Bindings (value : Object)

속성 값

형식: System.Object

개체의 SafeArray입니다.

설명

Bindings는 지정된 명령의 모든 키 바인딩을 기술하는 문자열이 포함된 개체의 SafeArray를 설정하거나 반환합니다. 바인딩을 SafeArray에 추가한 다음 나중에 다시 설정하여 바인딩을 명령에 추가하고 SafeArray에서 바인딩을 제거한 다음 나중에 다시 설정하여 명령에서 바인딩을 제거할 수 있습니다.

각 문자열의 구문은 다음 중 하나이며, 여기서 "modifiers+"는 옵션입니다.

  • "scopename::modifiers+key"

  • "scopename::modifiers+key, modifiers+key"

한정자는 "ctrl+", "alt+" 및 "shift+"이며, 나타나는 순서는 상관 없습니다. 최초의 한정자나 키 지정자가 이중 콜론("::") 바로 뒤에 나옵니다. 키 시퀀스에서 모든 쉼표 구분 기호 다음에는 하나의 공백이 삽입됩니다.

"Ctrl+Space"와 같이 대/소문자를 혼용하여 모두 보고되지만 새 바인딩을 추가할 경우에는 임의의 대/소문자 조합을 사용할 수 있습니다.

바인딩 문자열에서 공백은 리터럴로 처리됩니다. 공백 및 탭 문자 등에는 이스케이프 시퀀스가 없습니다. 다음은 바인딩 설정의 몇 가지 예를 나타냅니다.

  • "Text Editor::ctrl+r, ctrl+r"

  • "Global::ctrl+o"

  • "Global::f2"

Bindings는 바인딩을 사용할 수 없는 명령, 즉 도구 옵션 키보드 바인딩 속성 페이지에 표시되지 않는 명령에 대해 Nothing을 반환합니다. 이러한 명령에 이 속성을 설정하려고 하면 오류가 반환됩니다.

참고:

기본 키보드 매핑 구성표의 설정을 프로그래밍 방식으로 변경할 수 없습니다. 설정을 변경하려면 옵션 대화 상자의 키보드 노드에서 기본 키보드 매핑 구성표의 복사본을 저장합니다. 그런 다음 이 매핑 구성표에서 설정을 변경할 수 있습니다.

예제

' Macro code.
Sub BindingsExample()
    Dim cmds As Commands
    Dim cmd As Command
    Dim props As EnvDTE.Properties = DTE.Properties("Environment", _
    "Keyboard")
    Dim prop As EnvDTE.Property

    ' Set references to the Commands collection and the File.NewFile 
    ' command.
    cmds = DTE.Commands
    cmd = cmds.Item("File.NewFile")

    ' Assigns the command (File.NewFile) globally to the F2 key.
    ' Because you cannot programmatically change the default keyboard 
    ' mapping scheme settings, you must first make a copy of the 
    ' Default Settings for the Keyboard Mapping Scheme.
    prop = props.Item("Scheme")
    ' Sets the Scheme property value to a new keyboard scheme.
    ' This saves the old keyboard mapping scheme and allows you 
    ' to add new key mappings.
    MsgBox("PROP NAME: " & prop.Name & "   VALUE: " & prop.Value)
    prop.Value = "C:\Documents and Settings\johndoe\Application _
    Data\Microsoft\VisualStudio\8.0\MyNewKbdScheme.vsk"
    MsgBox("PROP NAME: " & prop.Name & "   VALUE: " & prop.Value)
    cmd.Bindings = "Global::f2"
End Sub

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Command 인터페이스

Command 멤버

EnvDTE 네임스페이스

기타 리소스

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