Microsoft® .NET Compact Framework (Core Reference)
by Andy Wigley, Stephen Wheelwright, Robert Burbidge, Rory MacLoed, Mark Sutton
Creating a Component
The controls demonstrated so far have been visual; they have a size and a position on the screen. Not all controls have position on the designer surface. Consider the Timer and MainMenu controls from the toolbox. You can create custom controls of this kind by basing your control on the Component class rather than on the Control class or a specific toolbox class such as TextBox. The Component class is simpler than Control: it provides an implementation of the IComponent interface, which works alongside the ISite interface provided by a container class such as a form.
The following code is a simple component called CalcComponent that adds and subtracts integers with Add and Subtract methods. Clearly, it is not sophisticated, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access