Control.createGraphics

Overview | Methods | Fields | This Package | All Packages

Control.createGraphics

Creates a Graphics object that can be used to draw in the client area of the control.

Syntax

public final Graphics createGraphics()

public final Graphics createGraphics( int dc )

Parameters

dc

An integer that represents a handle to a device context (HDC) to wrap in the Graphics object. The Graphics object does not claim ownership of the device context; you are responsible for freeing the device context.

Return Value

Returns a Graphics object that can be used to draw in the client area of the control.

Remarks

The brush, font, foreground color, and background color of the control determine the default values for the Graphics object. Use the dispose method of the returned Graphics object to free resources allocated by the Graphics object when the object is no longer needed. The Graphics object is valid only for the duration of the current window's message. To create a Graphics object that allows you to draw in the entire window for the control instead of just in the client area, use the createWindowGraphics method.

Creates a Graphics object that can be used to draw in the client area of the control.