Udostępnij za pośrednictwem


Metoda Package.FindToolWindow —

Pobiera okno narzędzie odpowiadające określonego typu i identyfikator.

Przestrzeń nazw:  Microsoft.VisualStudio.Shell
Zestaw:  Microsoft.VisualStudio.Shell.11.0 (w Microsoft.VisualStudio.Shell.11.0.dll)

Składnia

'Deklaracja
Public Function FindToolWindow ( _
    toolWindowType As Type, _
    id As Integer, _
    create As Boolean _
) As ToolWindowPane
public ToolWindowPane FindToolWindow(
    Type toolWindowType,
    int id,
    bool create
)

Parametry

  • toolWindowType
    Typ: System.Type
    Typ okna narzędzia do tworzenia.
  • id
    Typ: System.Int32
    Identyfikator narzędzia okna.Jest to 0 dla okna narzędzia jednego wystąpienia.
  • create
    Typ: System.Boolean
    Jeśli true, okno Narzędzie jest tworzony, jeśli nie istnieje.

Wartość zwracana

Typ: Microsoft.VisualStudio.Shell.ToolWindowPane
Wystąpienie okna żądane narzędzie.Jeśli create jest false i narzędzie okno nie istnieje, nullodwołanie o wartości null (Nothing w języku Visual Basic) jest zwracany.

Wyjątki

Wyjątek Warunek
ArgumentNullException

toolWindowTypeis nullodwołanie o wartości null (Nothing w języku Visual Basic).

ArgumentException
  • toolWindowTypenie pochodzi od ToolWindowPane.

  • toolWindowTypenie ma on publicznego konstruktora.

Uwagi

FindToolWindow Metoda zwraca okno Narzędzie i utworzy go, jeśli żądana.

Przykłady

private void OnMyMenuCommand(object sender, EventArgs e)
{

    // Locates the tool window. This uses IVSUIShell.FindToolWindow
    // to locate an existing tool window. Because true is passed
    // here as the last parameter, the tool window is created
    // if it does not exist in Visual Studio.
    ToolWindowPane w = _package.FindToolWindow(typeof(MyToolWindow), 0, true);

// Shows the tool window. This calls CreateToolWindow
// on IVSUIShell if the tool window does not exist yet.
    w.Show();

}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Package Klasa

Przestrzeń nazw Microsoft.VisualStudio.Shell