다음을 통해 공유


Window.Object 속성

런타임에 이름으로 액세스할 수 있는 개체를 가져옵니다.

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

구문

‘선언
ReadOnly Property Object As Object
Object Object { get; }
property Object^ Object {
    Object^ get ();
}
abstract Object : Object with get
function get Object () : Object

속성 값

형식: Object
개체입니다.

설명

창에 표시된 도구에 대한 확장성 개체를 반환합니다.

예제

Sub ObjectExample(ByVal dte As DTE2)

    ' Create a new text file and insert ten lines of text.
    dte.ItemOperations.NewFile()
    Dim textDoc As TextDocument = _
        CType(dte.ActiveDocument.Object(), TextDocument)
    Dim editPnt As EditPoint = textDoc.StartPoint.CreateEditPoint()
    Dim i As Integer
    For i = 1 To 10
        editPnt.Insert("Line " & i.ToString() & vbCrLf)
    Next

    If MsgBox("Reverse the order of the lines?", MsgBoxStyle.YesNo) = _
        MsgBoxResult.Yes Then
        Dim textSel As TextSelection = textDoc.Selection

        ' Position insertion point at beginning of "Line 2".
        textSel.StartOfDocument()
        textSel.LineDown()

        ' Reverse the order of the lines by cutting "Line 2" and
        ' pasting it at the start of the document, then cutting
        ' "Line 3" and pasting it at the start of the document,
        ' and so on.
        For i = 1 To 9
            textSel.LineDown(True)
            textSel.Cut()
            editPnt.StartOfDocument()
            editPnt.Paste()
        Next
    End If

End Sub
public void ObjectExample (DTE2 dte)
{
    // Create a new text file and insert ten lines of text.
    dte.ItemOperations.NewFile(@"General\Text File", "", 
        Constants.vsViewKindPrimary);
    TextDocument textDoc = 
        (TextDocument)dte.ActiveDocument.Object("TextDocument");
    EditPoint editPnt = textDoc.StartPoint.CreateEditPoint();
    
    for (int i = 1; i <= 10; i++)
        editPnt.Insert("Line " + i.ToString() + "\n");

    if (MessageBox.Show("Reverse the order of the lines?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        TextSelection textSel = textDoc.Selection;

        // Position insertion point at the beginning of "Line 2".
        textSel.StartOfDocument(false);
        textSel.LineDown(false, 1);

        // Reverse the order of the lines by cutting "Line 2" and
        // pasting it at the start of the document, then cutting
        // "Line 3" and pasting it at the start of the document,
        // and so on.
        for (int i = 1; i <= 9; i++)
        {
            textSel.LineDown(true, 1);
            textSel.Cut();
            editPnt.StartOfDocument();
            editPnt.Paste();
        }
    }
}

.NET Framework 보안

참고 항목

참조

Window 인터페이스

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행