Extender Providers
Although
the Control class provides a very rich set of
features, inevitably it cannot be all things to all people. UI
innovations continue to emerge, so even if the
Control class were to represent the state of the
art today, in time, it would inevitably end up looking short on
features.
However, Windows Forms provides a very useful way of extending the
abilities of the basic Control class. It is
possible to place a component on a form that adds a feature to every
single control on that form. Such a component is referred to as an
extender provider. We will see how to write
extender providers in Chapter 9, but no discussion
of forms would be complete without looking at how to use them.
The Forms Designer supports extender
providers. An extender provider can add new properties to all
controls on a form. An example of this in the Windows Forms framework
is the
ToolTip class. As
mentioned in Chapter 2, the
Control class does not provide ToolTip support.
But this doesn’t matter—the framework has a
ToolTip class that is able to augment any control
with ToolTip support. If you drop the ToolTip
component onto a form, it will appear in the component tray at the
bottom of the designer. (All non-UI components appear here; the only
kind of component that has any business appearing on the form at
design time is a control, so everything else appears in the component
tray. And the ToolTip isn’t strictly a UI component; it is a component that modifies the behavior of other controls.) ...
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