CLKing31-----LineTo function

LineTo

 Edit  discussion  upload video

WINGDIAPI BOOL WINAPI LineTo(HDChdc,intX,intY,);

Use the current pen to draw a line from the current position to a specified point. After this function is called , the current position becomes x, y.

Used in conjunction with the MoveTo function, see the example for details.

Chinese name

LineTo

table of Contents

  1. definition
  2. parameter description
  3. example

definition

edit

Use the current pen to draw a line from the current position to a specified point. After this function is called , the current position becomes x, y

WINGDIAPI BOOL WINAPI LineTo(HDChdc,intX,intY,);

Parameter Description

edit

hdc: device scene handle

X: X coordinate position of the end point of the line segment, expressed in logical coordinates. This point will not actually be drawn; it is not part of the line segment

Y: Y coordinate position of the end point of the line segment, expressed in logical coordinates. This point will not actually be drawn; it is not part of the line segment

return value:

Return TRUE for success, FALSE for failure

Example

edit

Header file: Gdi32.h

Use GDI drawing:

1

2

3

4

5

6

7

8

9

10

11

12

HDC hdc;//设备场景DC

PAINTSTRUCT ps;

HPEN hPen;

HPEN hPenOld;

hdc = BeginPaint( hWnd , &ps );

hPen = CreatePen( PS_SOLID, 3, RGB( 255, 0, 0 ));

hPenOld = ( HPEN )SelectObject ( hdc, hPen );

MoveToEx ( hdc, 20, 10, NULL );

LineTo( hdc, 200,100);

SelectObject (hdc , hPenOld);

DeleteObject ( hPen );

EndPaint ( hWnd , &ps );

 

Guess you like

Origin blog.csdn.net/qq_43662480/article/details/114954198