描述
设置箭头帽的高度.这是从箭头到顶点的距离.
C++ Syntax
Status SetHeight( [in] REAL height ); |
FreeBASIC 语法
FUNCTION SetHeight ( _ BYVAL nHeight AS SINGLE _ ) AS GpStatus |
参数
nHeight
[in]简单精度数,指定的高度,单位为箭头帽.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpLineCaps.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates an AdjustableArrowCap, pMyArrowCap, and sets the height of the
' cap to 15 pixels. The code then creates a Pen and assigns pMyArrowCap as the ending line cap
' for this Pen. Next, the code draws a capped line.
' ========================================================================================
SUB Example_SetHeight (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, 5, CTRUE)
' // Adjust to DPI by setting the scale width
myArrow.SetWidthScale(rxRatio)
' // Create a Pen, and assign myArrow as the end cap
DIM arrowPen AS CGpPen = GDIP_ARGB(255, 0, 0, 0)
arrowPen.SetCustomEndCap(@myArrow)
' // Get the width of the arrow
DIM nWidth AS SINGLE = myArrow.GetWidth
' // Draw a line using arrowPen
graphics.DrawLine(@arrowPen, 0, 0, 100, 100)
' // Set height equal to width and draw another line
myArrow.SetHeight(nWidth)
arrowPen.SetCustomEndCap(@myArrow)
graphics.DrawLine(@arrowPen, 0, 40, 100, 140)
END SUB
' ========================================================================================