Has anyone successfully worked with the toolbox in the VS.NET IDE? It seems that all the information you can get from the EnvDTE object model is the name of a toolbox item, but not it's parent class or containing .DLL. This code, swiped shamelessly from a VB.NET sample and turned into C# seems to work OK for getting the names of the things in the toolbox:
private void myButton2_Click(object sender, System.EventArgs e)
{
// Get an instance of the currently running Visual Studio .NET IDE.
EnvDTE.DTE DTE;
DTE = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1");
//Define the variables and create an object reference to the IDE's
//ToolBox object.
EnvDTE.Window win = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindToolbox);
EnvDTE.ToolBox objToolbox = (EnvDTE.ToolBox)win.Object;
EnvDTE.ToolBoxTabs colTbxTabs = objToolbox.ToolBoxTabs;
EnvDTE.ToolBoxTab ActiveTab = objToolbox.ActiveTab;
//Now you can manipulate the ToolBox.
//List the total number of tabs in the ToolBox.
string ToolBoxTabs = "";
foreach (EnvDTE.ToolBoxTab tabs in colTbxTabs)
{
if (ActiveTab.Name == tabs.Name)
{
ToolBoxTabs += "* " + tabs.Name + "\n";
foreach (EnvDTE.ToolBoxItem items in tabs.ToolBoxItems)
{
ToolBoxTabs += " -" + items.Name + "\n";
}
}
else
{
ToolBoxTabs += tabs.Name + "\n";
}
}
MessageBox.Show(ToolBoxTabs);
}
I'd like to build a tool to subclass all classes in a toolbox tab. So far, no luck working with the binary toolbox.tbd file either <g>.
Thanks,
Mike
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only