RAD Studio |  |

Creating Graphic Controls

If your control does not need to receive input focus, you can make it a graphic control. Graphic controls are similar to windowed controls, but have no window handles, and therefore consume fewer system resources. Components like TLabel, which never receive input focus, are graphic controls. Although these controls cannot receive focus, you can design them to react to mouse messages.

You can create custom controls through the TGraphicControl component. TGraphicControl is an abstract class derived from TControl. Although you can derive controls directly from TControl, it is better to start from TGraphicControl, which provides a canvas to paint on and on Windows, handles WM_PAINT messages; all you need to do is override the Paint method.

The section Creating a graphic control presents an example of creating a graphic control.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!