Export (0) Print
Expand All
Expand Minimize

Graphics.Clear method

Applies to: desktop apps only

The Graphics::Clear method clears a Graphics object to a specified color.

Syntax

Status Clear(
  [in, ref]  const Color &color
);

Parameters

color [in, ref]

Type: const Color

Reference to the Color object that specifies the color to paint the background.

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 Graphics object and a Color object. The code then clears the Graphics object to a color specified by the Color object.


VOID Example_Clear(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a Color object.
   Color blueColor(255, 0, 0, 255);

   // Clear the screen with a blue background.
   graphics.Clear(blueColor);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
Color
DrawRectangle Methods

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft