Brush::GetLastStatus method (gdiplusbrush.h)

The Brush::GetLastStatus method returns a value that indicates the nature of this Brush object's most recent method failure.

Syntax

Status GetLastStatus();

Return value

Type: Status

The Brush::GetLastStatus method returns an element of the Status enumeration.

If no methods invoked on this Brush object have failed since the previous call to Brush::GetLastStatus, then Brush::GetLastStatus returns Ok.

If at least one method invoked on this Brush object has failed since the previous call to Brush::GetLastStatus, then Brush::GetLastStatus returns a value that indicates the nature of the most recent failure.

Remarks

You can call Brush::GetLastStatus immediately after constructing a Brush object to determine whether the constructor succeeded.

The first time you call the Brush::GetLastStatus method of a Brush object, it returns Ok if the constructor succeeded and all methods invoked so far on the Brush object succeeded. Otherwise, it returns a value that indicates the nature of the most recent failure.

Examples

The following example creates a SolidBrush object solidBrush and checks the status of the call used to create solidBrush. Then, if the call was successful, the code uses solidBrush to fill a rectangle.

VOID Example_GetLastStatus(HDC hdc)
{
   Graphics graphics(hdc);
   // Create a SolidBrush object.
   SolidBrush solidBrush(Color(255, 0, 255, 0));
   // Get the status of the last call.
   Status lastStatus = solidBrush.GetLastStatus();
   //If the call to create myBrush was successful, use it to fill a rectangle.
   if (lastStatus == Ok)
       graphics.FillRectangle(&solidBrush, Rect(0, 0, 100, 100)); 
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusbrush.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Brush

Brushes and Filled Shapes

HatchBrush

LinearGradientBrush

PathGradientBrush

SolidBrush

TextureBrush

Using a Brush to Fill Shapes