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

DrawPath

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

描述

 

绘制一系列直线和一GraphicsPath对象定义的曲线.

 

C++ Syntax

 

Status DrawPath(

[in]  const Pen *pen,

[in]  const GraphicsPath *path

);

 

FreeBASIC 语法

 

FUNCTION DrawPath ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pPath AS CGpGraphicsPath PTR _

) AS GpStatus

 

参数

 

pPen

 

[in]指针的那一支钢笔是用来绘制路径.

 

pPath

 

[in]指向GraphicsPath对象指定的直线和曲线构成的路径序列.

 

返回值

 

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

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

 

引用文件

 

CGpBitmap.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example draws a GraphicsPath object.

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

SUB Example_DrawPath (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 GraphicsPath, and add an ellipse

  DIM ellipsePath AS CGpGraphicsPath

  ellipsePath.AddEllipse(100, 70, 200, 100)

 

  ' // Create a Pen object

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

 

  ' // Draw ellipsePath.

  graphics.DrawPath(@blackPen, @ellipsePath)

 

END SUB

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