References.Parent, propriété

Obtient l'objet parent immédiat d'un objet donné.

Espace de noms :  VSLangProj
Assembly :  VSLangProj (dans VSLangProj.dll)

Syntaxe

'Déclaration
ReadOnly Property Parent As Object
    Get
Object Parent { get; }
property Object^ Parent {
    Object^ get ();
}
abstract Parent : Object
function get Parent () : Object

Valeur de propriété

Type : System.Object

Notes

La propriété Parent retourne le parent immédiat de l'objet ou de la collection. Si vous souhaitez obtenir la collection qui le contient, utilisez la propriété Collection.

Exemples

Sub ParentExample(ByVal dte As DTE2)

    ' Retrieve and show the Output window.
    Dim outWin As OutputWindow = dte.ToolWindows.OutputWindow
    outWin.Parent.AutoHides = False
    outWin.Parent.Activate()

    ' Find the "Pane1" Output window pane; if it doesn't exist, 
    ' create it.
    Dim pane1 As OutputWindowPane
    Try
        pane1 = outWin.OutputWindowPanes.Item("Pane1")
    Catch
        pane1 = outWin.OutputWindowPanes.Add("Pane1")
    End Try

    ' Find the "Pane2" Output window pane; if it doesn't exist, 
    ' create it.
    Dim pane2 As OutputWindowPane
    Try
        pane2 = outWin.OutputWindowPanes.Item("Pane2")
    Catch
        pane2 = outWin.OutputWindowPanes.Add("Pane2")
    End Try

    MsgBox("The active Output window pane is " & _
        outWin.ActivePane.Name)

    If MsgBox("Activate Pane1?", MsgBoxStyle.YesNo) = _
        MsgBoxResult.Yes Then
        pane1.Activate()
    End If

    MsgBox("The active Output window pane is " & _
        outWin.ActivePane.Name)

End Sub
public void ParentExample(DTE2 dte)
{
    // Retrieve and show the Output window.
    OutputWindow outWin = dte.ToolWindows.OutputWindow;
    outWin.Parent.AutoHides = false;
    outWin.Parent.Activate();

    // Find the "Pane1" Output window pane; if it doesn't exist, 
    // create it.
    OutputWindowPane pane1 = null;
    try
    {
        pane1 = outWin.OutputWindowPanes.Item("Pane1");
    }
    catch
    {
        pane1 = outWin.OutputWindowPanes.Add("Pane1");
    }

    // Find the "Pane2" Output window pane; if it doesn't exist, 
    // create it.
    OutputWindowPane pane2;
    try
    {
        pane2 = outWin.OutputWindowPanes.Item("Pane2");
    }
    catch
    {
        pane2 = outWin.OutputWindowPanes.Add("Pane2");
    }

    MessageBox.Show("The active Output window pane is " + 
        outWin.ActivePane.Name);

    if (MessageBox.Show("Activate Pane1?", "", MessageBoxButtons.YesNo) 
        == DialogResult.Yes)
        pane1.Activate();

    MessageBox.Show("The active Output window pane is " + 
        outWin.ActivePane.Name);
}

Sécurité .NET Framework

Voir aussi

Référence

References Interface

VSLangProj, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation