Visual Inheritance

After all the settings and behavior and layout details you've learned to pack into forms in this chapter, you may decide that you'd like to keep some of your hard work in a Form-derived base class for easy reuse by further derivations, and you can certainly do that. If you follow the convention that forms initialize their own properties and the properties of their child controls in a function called InitializeComponent, the Designer provides direct support for your visual inheritance: the reuse of a form base class via inheritance.

Table 2.1. Parent Menu Merge Settings
Parent MenuItemMergeTypeMergeOrder
FileMergeItems0

File | New Child

Add0

File | Exit

Add2
WindowAdd2
Table 2.2. Child Menu Merge Settings
Child MenuItemMergeTypeMergeOrder ...

Get Windows Forms Programming in C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.