ToolBoxItem2.DTE Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft das Erweiterbarkeitsobjekt der obersten Ebene ab.
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(2)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(2)] get; }
[<System.Runtime.InteropServices.DispId(2)>]
[<get: System.Runtime.InteropServices.DispId(2)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE
Eigenschaftswert
Ein DTE-Objekt.
Implementiert
- Attribute
Beispiele
In diesem Beispiel wird das zweite Element ausgewählt und der zugehörige ToolBoxItem2 Name in einem Meldungs Feld angezeigt. Das Beispiel zeigt auch die Beschriftung für das aktive Fenster an, das über das-Objekt abgerufen wird ToolBoxItem2.DTE .
Imports EnvDTE
Imports EnvDTE80
Sub ToolBoxItemDTEExample(ByVal dte As DTE2)
Dim tlBox As ToolBox
Dim tbxTabs As ToolBoxTabs
Dim tbxTab As ToolBoxTab2
Dim tbxItem As ToolBoxItem2
' Before running this example, open a Windows Application project.
Try
' Create an object reference to the IDE's ToolBox object and
' its tabs.
tlBox = CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindToolbox).Object, ToolBox)
tbxTabs = tlBox.ToolBoxTabs
' Select the second Toolbox tab.
tbxTab = CType(tbxTabs.Item(2), ToolBoxTab2)
tbxTab.Activate()
MsgBox("Toolbox tab name: " & tbxTab.Name)
tbxItem = CType(tbxTab.ToolBoxItems.Item(2), ToolBoxItem2)
MsgBox("Toolbox item name: " & tbxItem.Name)
MsgBox(tbxItem.Name & "'s active window caption, _
obtained through the DTE object:" & vbCr _
& tbxItem.DTE.ActiveWindow.Caption)
Catch ex As System.Exception
MsgBox("ERROR: " & ex.Message)
End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void ToolBoxItemDTExample(DTE2 dte)
{
ToolBox tlBox;
ToolBoxTabs tbxTabs;
ToolBoxTab2 tbxTab;
ToolBoxItem2 tbxItem;
// Before running this example, open a Windows Application project
// and select Toolbox from the View menu.
try
{
// Create an object reference to the IDE's ToolBox object
// and its tabs.
tlBox = (ToolBox)_applicationObject.Windows.Item
(Constants.vsWindowKindToolbox).Object;
tbxTabs = tlBox.ToolBoxTabs;
// Select the second Toolbox tab.
tbxTab = (ToolBoxTab2)tbxTabs.Item(2);
tbxTab.Activate();
MessageBox.Show("Toolbox tab name: " + tbxTab.Name);
tbxItem = (ToolBoxItem2)tbxTab.ToolBoxItems.Item(2);
MessageBox.Show("Toolbox item name: " + tbxItem.Name);
MessageBox.Show(tbxItem.Name + "'s active window caption,
obtained through the DTE object:" + "\n"
+ tbxItem.DTE.ActiveWindow.Caption);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}
}
Hinweise
In Visual Studio ist das- DTE Objekt der Stamm des Automatisierungs Modells, das von anderen Objekt Modellen oft als "Application" bezeichnet wird.