Inheriting from the Control Class

Inheriting from an existing control is a useful technique if the control you want to build can be described and implemented conveniently using the inheritance relationship "is a." In the previous sample, a text box with numeric-only input "is a" special kind of text box. This is not always the case, especially if the custom control is not closely related to any existing controls or if the custom control is a collection of existing controls.

If the new control is not related to an existing control, you must inherit from a more generic class. The .NET Compact Framework allows the developer to inherit from the Windows.System.Forms.Control class. Figure 18-1 shows a portion of the .NET Framework class hierarchy in ...

Get Microsoft® .NET Compact Framework (Core Reference) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.