LineTo function (wingdi.h)

The LineTo function draws a line from the current position up to, but not including, the specified point.


BOOL LineTo(
  [in] HDC hdc,
  [in] int x,
  [in] int y


[in] hdc

Handle to a device context.

[in] x

Specifies the x-coordinate, in logical units, of the line's ending point.

[in] y

Specifies the y-coordinate, in logical units, of the line's ending point.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.


The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.

If LineTo succeeds, the current position is set to the specified ending point.


For an example, see Drawing Markers.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Line and Curve Functions

Lines and Curves Overview