描述
获取此实心画笔的颜色.
FreeBASIC 语法
FUNCTION GetColor () AS ARGB |
返回值
这个固体刷子的颜色.
引用文件
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
' // 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
' ========================================================================================