How do I set the category for a toolbox item?

2019-03-03 19:53发布

I have a follow up question to this one. Now that I have only the control I want showing up in the Toolbox in Visual Studio, how do I set the Category? It currently shows up in a category titled with the assembly name. I would rather use our company name. I have read how I can create my own ToolboxItem derived class to do this, but that seems an odd requirement. Is there another attribute for the Category? I found teh Category attribute, but that is for properties.

2条回答
狗以群分
2楼-- · 2019-03-03 20:22

If you are looking for categorizing the controls in VS 2008 or later Visual studios, you need to do some tweaking in registry to categorize the controls.

Have you tried this MSDN link for configuring Toolbox? MSDN

I am not sure how far it works for VS 2005, but it works perfectly for VS 2008 and VS 2010. You can create your own C# script or any other language script to configure the Toolbox instead of using WIX (if you are unfamiliar).

In the registry settings,

 <Registry Root="HKLM"
                  Key="Software\Microsoft\VisualStudio\9.0\ToolboxControlsInstaller\WebControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1631b3e7a8fbcce5, processorArchitecture=MSIL"
                  Value="Litware Controls"
                  Type="string" >

Value= "Litware Controls" is represents the category of the control.

Note : If you are not able to find the msm file which has toolboxcontrolsinstaller custom action which is mentioned in the above article, you can just increase or decrease the DefaultItems value by 1 in the below registry location.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages{2c298b35-07da-45f1-96a3-be55d91c8d7a}\Toolbox

This is same for Visual Studio 2010 too, but you need to put 10.0 instead of 9.0.

查看更多
何必那么认真
3楼-- · 2019-03-03 20:33

right click ToolBox -> Add Tab -> name it -> drag your control there.

查看更多
登录 后发表回答