LineTo

2.x

  BOOL LineTo(hdc, nXEnd, nYEnd)    
  HDC hdc; /* handle of device context */
  int nXEnd; /* x-coordinate of line endpoint */
  int nYEnd; /* y-coordinate of line endpoint */

The LineTo function draws a line from the current position up to, but not including, the specified endpoint. The function uses the selected pen to draw the line and sets the current position to the coordinates (nXEnd,nYEnd).

Parameters

hdc

Identifies the device context.

nXEnd

Specifies the logical x-coordinate of the line's endpoint.

nYEnd

Specifies the logical y-coordinate of the line's endpoint.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Example

The following example sets the current position by using the MoveTo function before calling the LineTo function. The example uses POINT structures to store the coordinates.

HDC hdc;

POINT ptStart = {  12,  12 };
POINT ptEnd = { 128, 135 };

MoveTo(hdc, ptStart.x, ptStart.y);
LineTo(hdc, ptEnd.x, ptEnd.y);

See Also

MoveTo