Sign in Join
FPDoc Onlineexperiment

DrawArrow procedure

In unit GraphUtil

Draws a line with an arrow at the specified location on a canvas.

Declaration

pascal
procedure DrawArrow(Canvas: TCanvas; Direction: TScrollDirection; 
 Location: TPoint; Size: LongInt; 
 ArrowType: TArrowType=atSolid)

Description

DrawArrow is an overloaded procedure used to draw a line between the specified points with an arrow at the ending point.

Overloaded variants of the routine allow the arguments to be specified using various types. The variant with Direction, Location, Size, and ArrowType arguments can draw a line with an arrow head in horizontal or vertical directions only. The variant with the ArrowAngleRad argument allows the slope for sides on the arrow head to be specified as a number of radians.

Direction is a TScrollDirection enumeration value, and indicates the direction for the line and the arrow head. Allowed values include: sdLeft, sdRight, sdUp, or sdDown.

Location is a TPoint instance which contains the coordinates for the line starting point. This is the same as the p1 argument in an overloaded variant. p2 is the ending point for the line and the position where the tip of the arrow head is drawn.

Size contains the length of the line in pixels. It is used to calculate both the ending point for the line starting at Location, and the position where the tip of the arrow head is drawn.

ArrowType is a TArrowType enumeration value, and indicates the drawing style used for the arrow head. atSolid causes the arrow head to be drawn as a filled triangular polygon. atArrows causes two inclined lines to be draw at the tip of the arrow head using the slope angle specified in ArrowAngleRad.

ArrowAngleRad is a floating point value with the number of radians for the slope on the sides of the arrow head. The default value for the argument is defined in the NiceArrowAngle constant, and causes a 45 degree angle to be used to draw the inclined sides on arrow head. Use <angle>*pi/180 to convert an angle in degrees to radians.

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.