Creating Graphic Controls

From RAD Studio
Jump to: navigation, search

Go Up to Creating Components

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 Component presents an example of creating a graphic control.