VCL Classes: Graphic Controls |
|
Introduction to the Graphic Control |
A graphic control is an object that is equipped to show a graphic, partially or on its whole body. To provide a common interface to such controls, the VCL provides a class named TGraphicControl. The TGraphicControl class is derived from TControl: |
|
TGraphicControl is just a class. It is not a control. It provides a service that other controls can use.
The biggest service that a graphic control provides to its children is the canvas, as the TGraphicControl class is equipped with the Canvas property: __property Graphics::TCanvas * Canvas = {read=FCanvas}; As you should know already, the canvas is the platform on which you can draw things. From what we have learned so far, the canvas mostly allows us to display a picture by calling the Draw() method of the TCanvas class.
Another valuable service that the graphic control provides to its children is the ability to paint. To support this, the TGraphicControl class fires a Paint event: virtual void __fastcall Paint(void); This event sends a TWMPaint message. The main purpose of the Paint event is that it gets fired every time an object has to be painted or has to paint itself. To give you the ability to fire the Paint event any time regardless of where you are in your code, the TControl class is equipped with a method named Invalidate. Its syntax is: virtual void __fastcall Invalidate(void);
|
|
||
Home | Copyright © 2010-2016, FunctionX | |
|