描述
创建具有指定高度和宽度的可调节箭头线帽.箭线帽可以填充或nonfilled.中间插入默认为零.
C++ Syntax
AdjustableArrowCap( [in] REAL height, [in] REAL width, [in] BOOL isFilled ); |
FreeBASIC 语法
CONSTRUCTOR CGpAdjustableArrowCap ( _ BYVAL nHeight AS SINGLE, _ BYVAL nWidth AS SINGLE, _ BYVAL bIsFilled AS BOOL = CTRUE _ ) |
参数
nHeight
[in]单位长度,从基地到点箭头.
nWidth
[in]距离,单位,对箭的基础之间的角落.
IsFilled
[in]布尔值,指定是否填充的箭头.默认值是TRUE.
备注
中间插图是基数中点向顶点移动的单位数.中间插入零结果没有移位?底座为直线,使箭头呈三角形.一个正(大于零)中间的结果,在一个移位的指定数量的单位朝向顶点?该基地是一个箭头形状的指向点,给箭头帽型.一个负(小于零)中间的结果在一个移位指定数量的单位远离顶点?该基地成为箭头形状,指出从顶点,使箭头要么菱形形状(如果中间插入的绝对值等于高度)或扭曲的钻石形状.如果中间插图等于或大于箭头帽的高度,则帽不会全部出现.中间箭头的值仅在箭头盖被填充时影响箭头帽.中间插入默认值为零的时候,AdjustableArrowCap对象构造.
引用文件
CGpLineCaps.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates two AdjustableArrowCap objects, arrowCapStart and
' arrowCapEnd, and sets the fill mode to TRUE. The code then creates a Pen object and
' assigns arrowCapStart as the starting line cap for this Pen object and arrowCapEnd as
' the ending line cap. Next, draws a line.
' ========================================================================================
SUB Example_CreateAdjustableArrowCap (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 that is filled
DIM arrowCapStart AS CGpAdjustableArrowCap = CGpAdjustableArrowCap(10, 10, CTRUE)
' // Adjust to DPI by setting the scale width
arrowCapStart.SetWidthScale(rxRatio)
' // Create an AdjustableArrowCap that is not filled
DIM arrowCapEnd AS CGpAdjustableArrowCap = CGpAdjustableArrowCap(15, 15, FALSE)
' // Adjust to DPI by setting the scale width
arrowCapEnd.SetWidthScale(rxRatio)
' // Create a Pen
DIM arrowPen AS CGpPen = GDIP_ARGB(255, 0, 0, 0)
' // Assign arrowStart as the start cap
arrowPen.SetCustomStartCap(@arrowCapStart)
' // Assign arrowEnd as the end cap
arrowPen.SetCustomEndCap(@arrowCapEnd)
' // Draw a line using arrowPen
graphics.DrawLine(@arrowPen, 0, 0, 100, 100)
END SUB
' ========================================================================================