Create custom control entirely from scratch

false74

Well-known member
Joined
Aug 4, 2010
Messages
76
Programming Experience
Beginner
Currently when I make a custom component I inherit the UserControl class which gives me a bunch of predefined properties (size, backcolor, forecolor, etc etc), is there any way to start completely from scratch or a way to remove the uneeded properties and variables.
 
When you declare a Class it has no members. To be added to a form it must at least inherit Component class, this has very few members, and if it is a UI component it must at least inherit Control class, already quite a few members is defined here, not as many as UserControl class but still all common to all controls. This is the common approach to writing derived control classes (that is Control or more specific), for compound components that consist of multiple child controls UserControl class is the best start. From there you can Shadow and hide properties from code and designer usage. Going from a empty class to usable control by implementing the necessary interfaces and designers from scratch will probably take you forever.
 
Back
Top