如何通过将 dll 导入引用来在 C#.net for winforms 的工具箱中添加用户控件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2101171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add User control in the toolbox for C#.net for winforms by importing the dll to the reference?
提问by Harikrishna
I have one dll of usercontrol and I add to it to the references in my project. And now I want to access this usercontrol from toolbox but it does not appear in the toolbox. And I can access them by writing code, but I want it in toolbox and want to use by just dragging it to the form.
我有一个 usercontrol dll,我将其添加到我的项目中的引用中。现在我想从工具箱访问这个用户控件,但它没有出现在工具箱中。我可以通过编写代码来访问它们,但我希望它在工具箱中并且希望通过将其拖到表单中来使用。
采纳答案by Dave7896
You need to right click on the toolbox, select "Choose Items.." and browse to the dll containing the control.
您需要右键单击工具箱,选择“Choose Items..”并浏览到包含该控件的 dll。
回答by Stormenet
Right click on the toolbox -> Choose items...
右键单击工具箱 -> 选择项目...
回答by Reza Majidi
Right Click on empty field of toolbox and select "choose item" and then go to your project folder and select your dll file (or EXE file)
右键单击工具箱的空白字段并选择“选择项目”,然后转到您的项目文件夹并选择您的 dll 文件(或 EXE 文件)
回答by Andrew Dennison
Drag & Drop the dll (from explorer) to the desired category (in VS 2012).
将 dll(从资源管理器)拖放到所需的类别(在 VS 2012 中)。