User Controls in Windows Forms - Anything similar

2019-07-01 10:52发布

问题:

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.