[Overview][Constants][Types][Procedures and functions][Index] | Reference for unit 'GraphUtil' (#lcl)

# DrawArrow

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

## Declaration

Source position: graphutil.pp line 71

`procedure DrawArrow(`
`Canvas: TCanvas;`
`Direction: TScrollDirection;`
`Location: TPoint;`
`Size: LongInt;`
`ArrowType: TArrowType = atSolid`
`); procedure DrawArrow(`
`Canvas: TCanvas;`
`p1: TPoint;`
`p2: TPoint;`
`ArrowType: TArrowType = atSolid`
`); procedure DrawArrow(`
`Canvas: TCanvas;`
`p1: TPoint;`
`p2: TPoint;`
`ArrowLen: LongInt;`
`ArrowAngleRad: float = NiceArrowAngle;`
`ArrowType: TArrowType = atSolid`
`);`

## Arguments

`Canvas` |  | Canvas where the line and arrow are drawn.
`Direction` |  | Direction for arrow head. Left, Right, Up, or Down.
`Location` |  | TPoint instance with the canvas coordinates for the line starting point.
`Size` |  | Length of the line in pixels. Determines the ending point for the line and the position where the tip of the arrow head is drawn.
`ArrowType` |  | Drawing style for the arrow.

## Arguments

`Canvas` |  | Canvas where the line and arrow are drawn.
`p1` |  | TPoint instance with the starting point for the line drawn in the routine.
`p2` |  | TPoint instance with the ending point for the line drawn in the routine. It is also the position where the tip of the arrow head is drawn.
`ArrowType` |  | Drawing style for the arrow.

## Arguments

`Canvas` |  | Canvas where the line and arrow are drawn.
`p1` |  | TPoint instance with the starting point for the line drawn in the routine.
`p2` |  | TPoint instance with the ending point for the line drawn in the routine. It is also the position where the tip of the arrow head is drawn.
`ArrowLen` |  | Length in pixels for the arrow head. It is used as an offset from the ending point in the opposite direction used for the line.
`ArrowAngleRad` |  | Angle specified in radians used to draw the sloped sides on the arrow head.
`ArrowType` |  | Drawing style for the arrow.

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