views:

970

answers:

1

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?

+7  A: 

This is a duplicate and has been asked a few times before. You might find a better answer if you look in those other posts.

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.

Billy
Thanks - I searched but didn't see any questions that looked like a comparison of the 2 types.
Jon Tackabury
No problem, This was my first answer, it is always nice to start out easy.
Billy