PathGradientBrush.GetRectangle(RectF*) method

Applies to: desktop apps only

The PathGradientBrush::GetRectangle method gets the smallest rectangle that encloses the boundary path of this path gradient brush.

Syntax

Status GetRectangle(
  [out]  RectF *rect
);

Parameters

  • rect [out]
    Type: RectF*

    Pointer to a RectF object that receives the bounding rectangle.

Return value

Type:

Type: Status****

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

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.

VOID Example_GetRect(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 0));

   // Create a path gradient brush based on an array of points.
   Point points[] = { 
      Point(30, 20), 
      Point(150, 40), 
      Point(100, 100), 
      Point(60, 200) };

   PathGradientBrush pthGrBrush(points, 4);

   // Obtain information about the path gradient brush.
   RectF rect;
   pthGrBrush.GetRectangle(&rect);

   graphics.FillRectangle(&pthGrBrush, rect);
   graphics.DrawRectangle(&pen, rect); 
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluspath.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

PathGradientBrush

GraphicsPath

RectF

Creating a Path Gradient

Filling a Shape with a Color Gradient

Brushes and Filled Shapes

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012