如何将 UserControl 放入 Visual Studio 工具箱 [英] How to put a UserControl into Visual Studio toolBox
问题描述
我在我的项目中做了一个用户控件,构建项目后,我需要把它放在我的工具箱中,并将其用作通用控件.但我不能.UserControl
在我的项目命名空间中,我在右键菜单中尝试了 Choose Item
,但没有找到添加它的方法.
I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can't. the UserControl
is in my project namespace, and I tried Choose Item
in right click menu, but I didn't find a way to add it.
推荐答案
我在让它们像在 VS2008/2005 中一样自动添加到工具箱时遇到了问题.
I had problems getting them to add automatically to the toolbox as in VS2008/2005.
实际上有一个选项可以停止工具箱自动填充!
There's actually an option to stop the toolbox auto-populating!
转到工具>选项 >Windows 窗体设计器 >一般
Go to Tools > Options > Windows Forms Designer > General
在列表底部,您会找到工具箱 >AutoToolboxPopulate 在全新安装时默认为 False.将其设置为 true,然后重新构建您的解决方案.
At the bottom of the list, you'll find Toolbox > AutoToolboxPopulate which on a fresh install defaults to False. Set it true and then rebuild your solution.
您好,您的解决方案中的用户控件应该会自动添加到工具箱中.
Hey presto, the user controls in your solution should be automatically added to the toolbox.
您可能还需要重新加载解决方案.
You might have to reload the solution as well.
这篇关于如何将 UserControl 放入 Visual Studio 工具箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!