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....



OnBeforeDrawNeedle


Unit:SDL_meter
Class: TMeter
Declaration: property OnBeforeDrawNeedle: TBeforeDrawNeedleEvent;
{ TBeforeDrawNeedleEvent = procedure (Sender: TObject; Canvas: TCanvas; var NeedleDrawn: boolean) of object; }

The event OnBeforeDrawNeedle provides a hook for adding user defined graphics to the meter. The event is triggered before the needles are going to be drawn. Thus you can draw any graphics below the needle(s).

The parameter Canvas provides access to the canvas of the data area. 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. The variable parameter NeedleDrawn controls whether or not the needle is drawn by the component. Set NeedleDrawn to TRUE if you draw the needle yourself.

Hint 1: Any graphics drawn on the canvas during the OnBeforeDrawNeedle event will be hidden by the cover of the meter.

Hint 2: 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: 2012-Oct-25