The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



OnBeforeDrawScaleLabel


Unit:SDL_meter
Class: TMeter
Declaration: OnBeforeDrawScaleLabel: TmtBeforeDrawScaleLabelEvent;
{ TmtBeforeDrawScaleLabelEvent = procedure (Sender: TObject; Canvas: TCanvas; var CurrentTickLabel: string; ChartX, ChartY: integer) of object; }

The event OnBeforeDrawScaleLabel provides a hook for adding user defined graphics to the meter. The event is triggered immediately before a numeric tick label is drawn.

The variable parameter Canvas provides access to the canvas of the data area. The variable parameter CurrentTickLabel can be adjusted according to the requirements of the program (e.g. to append a measurement unit to it). The parameters ChartX and ChartY specify the position of the label (in pixel coordinates).

Please note that the state of the canvas (e.g. the color of its pen, or the fill mode of the brush) depends on the graphics elements drawn before.

Hint: In order to avoid unwanted size effects regarding characters displayed on canvases of different resolution (i.e. the screen and a printer) you should never directly assign the font size within the event. Use SetCanvasFontSizeScaled instead. So, for example, the statement Canvas.Font.Size := 12; should be replaced by SetCanvasFontSizeScaled (Canvas, 12);



Last Update: 2023-Dec-14