DTE 속성 컬렉션

환경 수준 속성은 옵션 대화 상자에 표시되는 계층에 해당하는 범주로 구성됩니다.예를 들어, DTE.Properties("TextEditor", "Basic")는 옵션 대화 상자에 있는 텍스트 편집기 노드 아래의 기본 노드에 있는 설정을 나타냅니다.대화 상자의 페이지에서 많은 설정은 속성으로도 표현됩니다.예를 들어, 텍스트 편집기 노드 아래 기본 노드의 페이지의 한 가지 설정은 탭 크기입니다.이 설정은 TabSizeTabSize 속성으로 나타냅니다.각 속성 항목에는 Value 속성에 의해 표시되는 하나 이상의 값이 있습니다.속성을 사용하여 값을 변경하는 방법에 대한 자세한 내용은 옵션 설정 제어를 참조하십시오.

다음 문서는 Visual Studio에 포함된 설정의 사전 정의된 범주를 나열합니다.

기존 옵션 페이지에 설정을 추가하거나 옵션 대화 상자에 사용자 지정 페이지를 추가하려면 Visual Studio SDK를 사용합니다.자세한 내용은 Development Tools Ecosystem Partner Portal 웹 사이트를 참조하십시오.

[!참고]

옵션 대화 상자의 일부 페이지에서는 자동화를 지원하지 않습니다.속성 페이지 지원 정보에 대한 자세한 내용은 옵션 페이지에서 속성 항목의 이름 확인를 참조하십시오.

IDE(통합 개발 환경)에서 옵션 대화 상자를 열려면 도구 메뉴에서 옵션을 클릭합니다.

예제

다음 예제에서는 옵션 대화 상자의 Text Editor 노드에서 C# 노드에 있는 General 페이지에 대해 액세스 가능한 속성 항목을 보는 방법에 대해 설명합니다.코드에서 "C#" 노드는 "CSharp"으로 나타내야 합니다. 추가 기능 예제를 실행하는 방법에 대한 자세한 내용은 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.

' Add-in code.
Public Sub OnConnection(ByVal application As Object, ByVal connectMode _
As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef _
custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection

    applicationObject = CType(application, EnvDTE.DTE)
    addInInstance = CType(addInInst, EnvDTE.AddIn)
    ' Pass the applicationObject member variable to the code example.
    PropertiesExample (applicationObject)
    End Sub

Sub PropertiesExample(ByVal dte As DTE)
    ' Create and initialize a variable to represent the C# 
    ' text editor options page.
    Dim txtEdCS As EnvDTE.Properties = _
    DTE.Properties("TextEditor", "CSharp")
    Dim prop As EnvDTE.Property
    Dim msg As String

    ' Loop through each item in the C# text editor options page. 
    For Each prop In txtEdCS
        msg += ("PROP NAME: " & prop.Name & "   VALUE: " & _
        prop.Value) & vbCr
    Next
    MsgBox(msg)
End Sub
// Add-in code.
Using System.Windows.Forms;
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst,
 ref System.Array custom)
{
    applicationObject = (_DTE)application;
    addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    PropertiesExample((DTE)applicationObject); 
}

public void PropertiesExample( DTE dte ) 
{ 
    // Create and initialize a variable to represent the C# 
    // text editor options page.
    EnvDTE.Properties txtEdCS =
 dte.get_Properties( "TextEditor", "CSharp" ); 
    EnvDTE.Property prop = null; 
    string msg = null; 

    // Loop through each item in the C# text editor options page. 
    foreach ( EnvDTE.Property temp in txtEdCS ) 
    { 
        prop = temp; 
        msg += ( "PROP NAME: " + prop.Name + "   VALUE: " 
+ prop.Value ) + "\n"; 
    }
    MessageBox.Show( msg); 
}

이전 예제가 약간 수정된 다음 예제에서는 중첩된 노드의 설정을 볼 수 있습니다. 이 경우 텍스트 편집기 노드의 C# 노드에 있는 서식 노드를 말합니다.수정하기 위해 두 번째 Properties 매개 변수 값을 보거나 변경하려는 설정으로 변경합니다(예: DTE.Properties("TextEditor", "Basic-Specific") 또는 DTE.Properties("Environment", "ProjectsAndSolution")).사용할 값이 이 문서의 시작 부분에 나열되어 있습니다.

여기에서는 "CSharp - Formatting"을 사용하여 C# 텍스트 편집기에 대한 서식 설정을 봅니다.

' Add-in code.
Sub PropertiesExample()
    ' Create and initialize a variable to represent the C# 
    ' Formatting text editor options page.
    Dim txtEdCSFormat As EnvDTE.Properties = _
    DTE.Properties("TextEditor", "CSharp-Specific")
    Dim prop As EnvDTE.Property
    Dim msg As String

    ' Loop through each item in the C# Formatting Options page. 
    For Each prop In txtEdCSFormat
        msg += ("PROP NAME: " & prop.Name & "   VALUE: " & _
        prop.Value) & vbCr
    Next
    MsgBox(msg)
End Sub

참고 항목

작업

방법: 사용자 지정 옵션 페이지 만들기

개념

옵션 설정 제어

옵션 페이지에서 속성 항목의 이름 확인