描述
设置笔划的线条连接样式.加入该行的指定两线相交的GraphicsPath对象造成了自定义线帽内加入.
C++ Syntax
Status SetStrokeJoin( [in] LineJoin lineJoin ); |
FreeBASIC 语法
FUNCTION SetStrokeJoin ( _ BYVAL nLineJoin AS LineJoin _ ) AS GpStatus |
参数
strokeJoin
该LineJoin指定线的加入,将用于两线由同一笔绘制的,有重叠的两端[in]元.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpLineCaps.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a CustomLineCap object with a stroke join. It then gets the
' stroke join and assigns it as the line join of a Pen object that it then uses to draw a line.
' ========================================================================================
SUB Example_SetStrokeJoin (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 start and end caps for custCap
custCap.SetStrokeJoin(LineJoinBevel)
' // Create a Pen object, assign strokeJoin as the line join,
' // and draw two joined lines in a path.
DIM strokeJoinPen AS CGpPen = CGpPen(GDIP_ARGB(255, 255, 0, 0), 15.1)
strokeJoinPen.SetCustomEndCap(@custCap)
graphics.DrawLine(@strokeJoinPen, 0, 0, 200, 200)
END SUB
' ========================================================================================
示例
' ========================================================================================
' The following example creates a CustomLineCap object with a stroke join. It then gets the
' stroke join and assigns it as the line join of a Pen object that it then uses to draw a line.
' ========================================================================================
SUB Example_SetStrokeJoin (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 start and end caps for custCap
custCap.SetStrokeJoin(LineJoinBevel)
' // Create a Pen object, assign strokeJoin as the line join,
' // and draw two joined lines in a path.
DIM strokeJoinPen AS CGpPen = CGpPen(GDIP_ARGB(255, 200, 150, 0), 5.0)
strokeJoinPen.SetCustomEndCap(@custCap)
graphics.DrawLine(@strokeJoinPen, 0, 0, 200, 200)
END SUB
' ========================================================================================