描述
设置此路径渐变画笔的中心颜色.中心颜色是出现在画笔中心点的颜色.
C++ Syntax
Status SetCenterColor( [in, ref] const Color &color ); |
FreeBASIC 语法
FUNCTION SetCenterColor ( _ BYVAL colour AS ARGB _ ) AS GpStatus |
参数
colour
[in] ARGB颜色指定颜色的中心.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
备注
默认情况下,中心点是画笔边界路径的重心,但可以将中心点设置到路径内外的任何位置.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a PathGradientBrush object based on an ellipse. The code
' calls the PathGradientBrush.SetCenterColor method of the PathGradientBrush object to set
' the center color to blue. The PathGradientBrush.SetSurroundColors method sets the color
' along the entire boundary to aqua. The FillRectangle Methods method uses the path gradient
' brush to paint a rectangle that contains the ellipse.
' ========================================================================================
SUB Example_SetCenterColor (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 that consists of a single ellipse.
DIM path AS CGpGraphicsPath
path.AddEllipse(0, 0, 200, 100)
' // Use the path to construct a brush.
DIM pthGrBrush AS CGpPathGradientBrush = @path
' // Set the color at the center of the path to blue.
pthGrBrush.SetCenterColor(GDIP_ARGB(255, 0, 0, 255))
' // Set the color along the entire boundary of the path to aqua.
DIM colors(0) AS ARGB = {GDIP_ARGB(255, 0, 255, 255)}
DIM count AS LONG = 1
pthGrBrush.SetSurroundColors(@colors(0), @count)
' // Fill the ellipse with the path gradient brush.
graphics.FillEllipse(@pthGrBrush, 0, 0, 200, 100)
END SUB
' ========================================================================================