Sdílet prostřednictvím


CommandWindow.Parent – vlastnost

Získá okamžitou nadřazeného objektu daného objektu.

Obor názvů:  EnvDTE
Sestavení:  EnvDTE (v EnvDTE.dll)

Syntaxe

'Deklarace
ReadOnly Property Parent As Window
    Get
Window Parent { get; }
property Window^ Parent {
    Window^ get ();
}
abstract Parent : Window
function get Parent () : Window

Hodnota vlastnosti

Typ: EnvDTE.Window
A Window objektu.

Poznámky

Parent Vrátí vlastnost bezprostřední nadřízený objekt nebo kolekce.

Příklady

public void CodeExample(DTE2 dte, AddIn addin)
{
    try
    {
        // Get a reference to a Command window.
        Window win = dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
        CommandWindow cmdWin = (CommandWindow)win.Object;
        // Add some text to the window.
        cmdWin.OutputString("This is a line of text in the CommandWindow TextDocument");
        // Return the contents of the TextDocument and display them.
        TextDocument txtDoc = cmdWin.TextDocument;
        TextSelection txtSel = txtDoc.Selection;
        TextRanges txtRanges = txtSel.TextRanges;
        // Show text in textdocument.
        foreach (TextRange txtRange in txtRanges)
        {
            txtRange.StartPoint.StartOfDocument();
            MessageBox.Show(txtRange.StartPoint.GetText(txtRange.EndPoint));
        }
        // Show the CommandWindow's parent object's caption property.
        MessageBox.Show("The Parent window's caption: " + cmdWin.Parent.Caption);
        // Show the application object containing the CommandWindow.
        MessageBox.Show(cmdWin.DTE.Name);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

CommandWindow Rozhraní

EnvDTE – obor názvů

Další zdroje

How to: Compile and Run the Automation Object Model Code Examples