描述
获?Т寺肪督ケ渌⒌谋呓缏肪兜淖钚【匦?
C++ Syntax
Status GetRectangle( [out] RectF* rect ) const; |
Status GetRectangle( [out] RectF& rect ) const; |
FreeBASIC 语法
FUNCTION GetRectangle ( _ BYVAL rc AS GpRectF PTR _ ) AS GpStatus |
FUNCTION GetRectangle ( _ BYVAL rc AS GpRect PTR _ ) AS GpStatus |
参数
rc
[out]指向GpRectF或GpRect接收边框结构.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a PathGradientBrush object based on a polygon that is defined
' by four points. The code calls the PathGradientBrush::GetRectangle method of the
' PathGradientBrush object to obtain the smallest rectangle that encloses the brush's
' boundary path. The code calls the Graphics.FillRectangle method of a Graphics object,
' passing the address of the PathGradientBrush object and a reference to the brush's bounding
' rectangle. That call fills only the portion of the bounding rectangle that is inside the
' brush's boundary path. Finally the code draws the outline of the bounding rectangle.
' ========================================================================================
SUB Example_GetRectangle (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)
DIM pen AS CGpPen = GDIP_ARGB(255, 0, 0, 0)
' // Create a path gradient brush based on an array of points.
DIM points(0 TO 3) AS GpPoint = {GDIP_POINT(30, 20), GDIP_POINT(150, 40), GDIP_POINT(100, 100), GDIP_POINT(60, 200)}
DIM pthGrBrush AS CGpPathGradientBrush = CGpPathGradientBrush(@points(0), 4)
' // Obtain information about the path gradient brush.
DIM rc AS GpRectF
pthGrBrush.GetRectangle(@rc)
graphics.FillRectangle(@pthGrBrush, @rc)
graphics.DrawRectangle(@pen, @rc)
END SUB
' ========================================================================================