What is the difference between a Control and a UserControl in .NET WinForms? I want to create a custom control, but which one should I inherit from? I've always used Control in the past without any issues, but is the "recommended" way of creating a custom control?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- How to use Control.FromHandle?
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
Here is a good article about this question. user controls
However in short
A Control is either inherited or completely custom. You write and handle many of the events yourself. You can even control how and when the control is drawn thru the use of GDI+ drawing.
A UserControl is a collection of controls placed together to be used in a certain way. For example you can place a GroupBox that contains Textbox’s, Checkboxes, etc. This is useful when you have to place the same group of controls on/in multiple forms or tabs. Note: you can write some custom events and drawing for UserControls also.