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

GetBaseCap

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

描述

 

获取基帽的样式.基帽作为盖在一行的末尾随着这CustomLineCap对象.

 

C++ Syntax

 

LineCap GetBaseCap();

 

FreeBASIC 语法

 

FUNCTION GetBaseCap () AS LineCap

 

参数

 

该方法没有参数.

 

返回值

 

此方法返回在该行的底部使用的行帽的值.

 

引用文件

 

CGpLineCaps.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a CustomLineCap object, sets its base cap, and then gets

' the base cap and assigns it to a Pen object. It then uses the Pen object to draw a line.

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

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

  DIM capPath AS CGpGraphicsPath

 

  ' // Create a CustomLineCap object, and set its base cap to LineCapRound

  DIM custCap AS CGpCustomLineCap = CGpCustomLineCap(NULL, @capPath)

  custCap.SetBaseCap(LineCapRound)

 

  ' // Get the base cap of custCap

  DIM baseCap AS LineCap = custCap.GetBaseCap

 

  ' // Create a Pen object, assign baseCap as the end cap, and draw a line

  DIM pen AS CGpPen = CGpPen(GDIP_ARGB(255, 0, 255, 0), 10)

  pen.SetEndCap(baseCap)

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

 

END SUB

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