导航:  GdiPlus Classes > GdiPlus Classes > CGpCustomLineCap Class > AdjustableArrowCap Object >

SetMiddleInset

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

描述

 

设置基础中点向顶点移动的单位数.

 

C++ Syntax

 

Status SetMiddleInset(

[in]  REAL middleInset

);

 

FreeBASIC 语法

 

FUNCTION SetMiddleInset ( _

   BYVAL middleInset AS SINGLE _

) AS GpStatus

 

参数

 

middleInset

 

[in]单精度数指定的基地转移到顶点的中点的单位数目.

 

返回值

 

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

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

 

引用文件

 

CGpLineCaps.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates an AdjustableArrowCap object, myArrow, and sets the middle

' inset of the cap to 5 pixels. The code then creates a Pen object and assigns myArrow as

' the ending line cap for this Pen object. Next, the code draws a capped line.

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

SUB Example_SetMiddleInset (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

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, rxRatio)

 

  ' // Create an AdjustableArrowCap with a height of 10 pixels

  DIM myArrow AS CGpAdjustableArrowCap = CGpAdjustableArrowCap(10, 10, CTRUE)

  ' // Adjust to DPI by setting the scale width

  myArrow.SetWidthScale(rxRatio)

  ' // Set the middle inset to 5

  myArrow.SetMiddleInset(5)

 

  ' // Create a Pen, and assign myArrow as the end cap

  DIM arrowPen AS CGpPen = GDIP_ARGB(255, 0, 0, 0)

  arrowPen.SetCustomEndCap(@myArrow)

 

  ' // Draw a line using arrowPen

  graphics.DrawLine(@arrowPen, 0, 0, 100, 100)

 

END SUB

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