问题描述
在 ASP.NET 中,您有一个叫做用户控件"的东西,它允许您设计一个可以在网站中重复使用的自定义控件.
In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website.
我现在开始在 .NET 2.0 中开发 Windows 应用程序,但(令人惊讶的是)我找不到类似的功能.
I am now starting developing a Windows application in .NET 2.0 and (surprisingly) I cannot find a similar functionality.
我想做的是:- 在设计器中创建一个新的用户控件;- 拖放在其上放置一些控件(例如按钮、文本框);- 保存,并能够通过将其拖放到各种对话框上来重新使用此用户控件.
What I would like to do is:- Create a new user control in the designer;- Drag & Drop a few controls on it (e.g. buttons, textboxes);- Save, and be able to resuse this user controls by dragging and dropping it on various dialogs.
任何建议将不胜感激.
谢谢,Giammarco Schisani
Thank you,Giammarco Schisani
推荐答案
在 WinForms 应用程序中创建、添加和使用 UserControl 的分步指南:http://www.devcity.net/Articles/87/ssteps_customcontrol.aspx
Step-by-step guide to create, add and use UserControls in WinForms applications: http://www.devcity.net/Articles/87/ssteps_customcontrol.aspx
主要步骤是:
- 创建库项目
- 添加或自定义默认用户控件
- 构建项目
- 添加一个新的 windows 应用程序项目
- 在设计器中打开表单:您的新控件出现.
这篇关于Windows 窗体中的用户控件 - 与 ASP.NET 用户控件类似吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!