User Controls in Windows Forms - Anything similar to ASP.NET User Controls?

杀马特。学长 韩版系。学妹 提交于 2020-02-03 09:55:45

问题


In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website.

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.

Any suggestion would be greatly appreciated.

Thank you, Giammarco Schisani


回答1:


UserControl

Step-by-step guide to create, add and use UserControls in WinForms applications: http://www.devcity.net/Articles/87/ssteps_customcontrol.aspx

Main steps are:

  • Create a library project
  • Add or customize the default UserControl
  • Build the project
  • Add a new windows application project
  • Open the Form in the designer: your new control appears.


来源:https://stackoverflow.com/questions/755869/user-controls-in-windows-forms-anything-similar-to-asp-net-user-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!