如何创建自定义控件并将其添加到Windows窗体C# [英] how to create custom control and add it to windows form c#

查看:813
本文介绍了如何创建自定义控件并将其添加到Windows窗体C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我是Windows应用程序C#中的新手.
我想在表单上添加一个multicoloum组合框.如何添加该自定义控件.

请帮助我

hello,
i m new in windows application c#.
i want to add a multicoloum combobox on my form. how can i add that custom control..

pls help me

推荐答案

1.创建Control.您可以继承ComboBoxUserControlControlFormNativeWindow.
2.也将其添加到您的Form.您可以从工具箱中选择它,也可以在Form的构造函数中添加逻辑.
1. Create the Control. You may inherit ComboBox, UserControl, Control, Form or NativeWindow.
2. Add it too your Form. You may either select it from the toolbox, or add the logic in your Form''s constructor.


如果您不熟悉C#,则应该学习使用控件在考虑编写自己的控件之前就已经存在.
If you''re new to C#, you should learn to use the controls that exist before you consider writing your own control.


假设这是一个扩展的dll,最简单的方法是:

右键单击工具箱",然后单击选择项目".
浏览",找到dll,然后单击确定".
现在,您可以像其他控件一样将其从工具箱中拖放,您的项目引用将自动更新.
Assuming this an extenal dll the easiest way is:

Right click on the ToolBox and ''Choose Items''.
''Browse'', find the dll and click OK.
Now you can drag and drop it from the ToolBox like any other control and your project references will be updated automatically.


这篇关于如何创建自定义控件并将其添加到Windows窗体C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆