描述
设置此路径渐变画笔的中心点.默认情况下,中心点位于画笔边界路径的中心位置,但可以将中心点设置为路径内或外部的任何位置.
C++ Syntax
Status SetCenterPoint( [in, ref] const PointF &point ); |
Status SetCenterPoint( [in, ref] const Point &point ); |
FreeBASIC 语法
FUNCTION SetCenterPoint ( _ BYVAL pt AS PointF PTR _ ) AS GpStatus |
FUNCTION SetCenterPoint ( _ BYVAL pt AS Point PTR _ ) AS GpStatus |
参数
pt
[in]参考一PointF或Point结构指定的中心点.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a PathGradientBrush object based on an ellipse. The code
' sets the center color to blue and sets the color along the boundary to aqua. By default,
' the center point would be at the center of the ellipse (100, 50), but the call to the
' PathGradientBrush.SetCenterPoint method sets the center point to (180.5, 50.0).
' ========================================================================================
SUB Example_SetCenterPoint (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 center point.
DIM pt AS GpPointF = GDIP_POINTF(180.5, 50.0)
pthGrBrush.SetCenterPoint(@pt)
' // 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)
graphics.FillRectangle(@pthGrBrush, 0, 0, 300, 300)
END SUB
' ========================================================================================