描述
设置刻度宽度的值.这是一个规模的自定义线帽相对于笔的宽度用来画线.对1.0默认值不规模的线帽.
C++ Syntax
Status SetWidthScale( [in] IN REAL widthScale ); |
FreeBASIC 语法
FUNCTION SetWidthScale ( _ BYVAL widthScale AS SINGLE _ ) AS GpStatus |
参数
widthScale
[in]简单精度数指定的比例因子,将用于扩展线宽度.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpLineCaps.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a CustomLineCap object and sets the width scale. It then
' gets the width scale, assigns the custom cap to a Pen object, and draws a line.
' ========================================================================================
SUB Example_SetWidthScale (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 Path object, and add two lines to it
DIM pts(0 TO 2) AS GpPoint = {GDIP_POINT(-15, -15), GDIP_POINT(0, 0), GDIP_POINT(15, -15)}
'#ifdef __FB_64BIT__
' DIM pts(0 TO 2) AS GpPoint = {(-15, -15), (0, 0), (15, -15)}
'#else
' ' // With the 32-bit compiler, the above syntax can't be used because a mess in the
' ' // FB headers for GdiPlus: GpPoint is defined as Point in 64 bit and as Point_ in 32 bit.
' DIM pts(0 TO 2) AS GpPoint
' pts(0).x = -15 : pts(0).y = -15 : pts(2).x = 15: pts(2).y = -15
'#endif
DIM capPath AS CGpGraphicsPath = FillModeAlternate
capPath.AddLines(@pts(0), 3)
' // Create a CustomLineCap object, and set its base cap to LineCapRound
DIM custCap AS CGpCustomLineCap = CGpCustomLineCap(NULL, @capPath)
' // Set the width scale for custCap.
custCap.SetWidthScale(3)
' // Assign custCap to a Pen object and draw a line.
DIM widthScalePen AS CGpPen = CGpPen(GDIP_ARGB(255, 180, 0, 180), 1.7)
widthScalePen.SetCustomEndCap(@custCap)
graphics.DrawLine(@widthScalePen, 0, 0, 200, 200)
END SUB
' ========================================================================================