描述
获取此实心画笔的颜色.
C++ Syntax
Status GetColor( [out] Color *color ) const; |
FreeBASIC 语法
FUNCTION GetColor (BYVAL colour AS ARGB PTR) AS GpStatus |
参数
colour
[out]变量指针接收这个坚实的画笔的颜色.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a solid brush and uses it to fill a rectangle. The code
' gets the color of the solid brush and stores it. Then, the code creates a second solid
' brush using the stored color and paints a second rectangle with the second solid brush.
' ========================================================================================
SUB Example_GetColor (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 a solid brush, and use it to fill a rectangle
DIM solidBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 255)
graphics.FillRectangle(@solidBrush, 10, 10, 200, 100)
' // Get the color of the solid brush
DIM colour AS ARGB
solidBrush.GetColor(@colour)
' // Create a second solid brush with that same color
DIM solidBrush2 AS CGpSolidBrush = colour
' // Paint a second rectangle with the second solid brush
graphics.FillRectangle(@solidBrush2, 220, 10, 200, 100)
END SUB
' ========================================================================================