描述
获取此画笔的类型.
C++ Syntax
Status GetType(); |
FreeBASIC 语法
FUNCTION GetType () AS GpBrushType |
参数
该方法没有参数.
返回值
此方法返回此画笔的类型.返回值是一个枚举元素的BrushType.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a SolidBrush object, checks the type of the object, and
' then, if the type is BrushTypeSolidColor, uses the brush to fill a rectangle.
' ========================================================================================
SUB Example_GetType (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 SolidBrush object
DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 255)
' // Get the type of solidBrush
DIM nType AS BrushType = solidBrush.GetType
' // If the type of solidBrush is BrushTypeSolidColor, use it to fill a rectangle
IF nType = BrushTypeSolidColor THEN
graphics.FillRectangle(@solidBrush, 0, 0, 100, 100)
END IF
END SUB
' ========================================================================================