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

GetMiddleInset

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

描述

 

获取插入的值.中间插图是基数中点向顶点移动的单位数.

 

C++ Syntax

 

REAL GetMiddleInset();

 

FreeBASIC 语法

 

FUNCTION GetMiddleInset () AS SINGLE

 

参数

 

该方法没有参数.

 

返回值

 

此方法返回插入值.

 

备注

 

中间插图是基数中点向顶点移动的单位数.中间插入零结果没有移位?底座为直线,使箭头呈三角形.一个正(大于零)中间的结果,在一个移位的指定数量的单位朝向顶点?该基地是一个箭头形状的指向点,给箭头帽型.一个负(小于零)中间的结果在一个移位指定数量的单位远离顶点?该基地成为箭头形状,指出从顶点,使箭头要么菱形形状(如果中间插入的绝对值等于高度)或扭曲的钻石形状.如果中间插图等于或大于箭头帽的高度,则帽不会全部出现.中间箭头的值仅在箭头盖被填充时影响箭头帽.中间插入默认值为零的时候,AdjustableArrowCap对象构造.

 

引用文件

 

CGpLineCaps.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates an AdjustableArrowCap object, myArrow, with middle

' inset set to zero (default value). The code then creates a Pen object, assigns

' myArrow as the ending line cap for this Pen object, and draws a capped line. Next,

' the code gets the middle inset, increments it, and draws another capped line.

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

SUB Example_GetMiddleInset (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)

 

  ' // 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, 20, 100, 20)

 

  ' // Get the inset of the arrow

  DIM inset AS SINGLE = myArrow.GetMiddleInset

 

  ' // Increase inset by 5 pixels and draw another line

  myArrow.SetMiddleInset(inset + 5)

  arrowPen.SetCustomEndCap(@myArrow)

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

 

END SUB

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