导航:  GdiPlus Classes > GdiPlus Classes > CGpGraphics Class > Graphics Object >

DrawLines

上一页返回章节概述下一页

描述

 

绘制连接线序列.

 

C++ Syntax

 

Status DrawLines(

[in]  const Pen *pen,

[in]  const PointF *points,

[in]  INT count

);

 

Status DrawLines(

[in]  const Pen *pen,

[in]  const Point *points,

[in]  INT count

);

 

FreeBASIC 语法

 

FUNCTION DrawLines ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPointF PTR, _

   BYVAL count AS LONG _

) AS GpStatus

 

FUNCTION DrawLines ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPoint PTR, _

   BYVAL count AS LONG _

) AS GpStatus

 

参数

 

pPen

 

[in]指针的那一支钢笔是用来画线.

 

pts

 

[in]指向PointF对象指定起始和终止点的线阵列.

 

nCount

 

[in]整数,指定的点的数组元素个数.

 

返回值

 

如果该方法成功,则返回Ok,这是对Status枚举元素.

如果这个方法失败,它返回一个枚举的其他元素的Status.

 

引用文件

 

CGpBitmap.inc (include CGdiPlus.inc)

 

示例

 

' ========================================================================================

' The following example draws a sequence of connected lines.

' ========================================================================================

SUB Example_DrawLines (BYVAL hdc AS HDC)

 

  ' // Create a graphics object from the window device context

  DIM graphics AS CGpGraphics = hdc

  ' // Get the DPI scaling ratio

  DIM rxRatio AS SINGLE = graphics.GetDpiX / 96

  DIM ryRatio AS SINGLE = graphics.GetDpiY / 96

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, ryRatio)

 

  ' // Create a Pen object

  DIM blackPen AS CGpPen = CGpPen(GDIP_ARGB(255, 0, 0, 0), 3)

 

  ' // Create an array of PointF objects that define the lines to draw

  DIM point1 AS GpPointF : point1.x =  10 : point1.y = 10

  DIM point2 AS GpPointF : point2.x =  10 : point2.y = 100

  DIM point3 AS GpPointF : point3.x = 200 : point3.y = 50

  DIM point4 AS GpPointF : point4.x = 250 : point4.y = 300

 

  DIM pts(0 TO 3) AS GpPointF

  pts(0) = point1

  pts(1) = point2

  pts(2) = point3

  pts(3) = point4

 

  ' // Draw the lines

  graphics.DrawLines(@blackPen, @pts(0), 4)

 

END SUB

' ========================================================================================