Drawing a lineΒΆ

LineTo()

Draw a line


SYNTAX

LineTo(window_id, to_x, to_y, [from_x, from_y])

Draw a straight line.

window_id

The identifier of the window in which the line is to be drawn. To print it in the current report, specify NULL instead of a window_id.

to_x, to_y

The x and y co-ordinates of the finishing point of the line. The function updates the current position to these values.

[from_x, from_y]

If these parameters are included, they specify the starting point of the line. Otherwise, the line is drawn from the current position.


EXAMPLE

This example draws a sine wave:

BeginPaint(Win1, Start_x, Start_y)
for (Loop = 1; Loop <= NumPoints; Loop = Loop + 1) {
     x = Loop * Start_x / NumPoints
     y = ((Start_y / 2) * (1.0 - sin((2 * 3.1415926) * (1/NumPoints))))
     LineTo(Win1,x,y)
}
EndPaint(Win1)

RELATED TOPICS

Drawing operations

Draw functions