![]() ![]() | ||
As its name suggests, and as discussed in the In Depth section of this chapter, you use the Graphics class to create graphics. Here's the class hierarchy of the Graphics class:
Object MarshalByRefObject Graphics
You can find the some notable public class (shared) methods of the Graphics class in Table 13.1, the notable public properties of Graphics objects in Table 13.2, and their more notable public methods in Table 13.3.
Method |
Means |
---|---|
FromHwnd |
Returns a new Graphics object given a Windows handle. |
FromImage |
Returns a new Graphics object given an Image object. |
Property |
Means |
---|---|
Clip |
Holds the drawing region of this Graphics object. |
DpiX |
Holds the horizontal resolution of this Graphics object. |
DpiY |
Holds the vertical resolution of this Graphics object. |
IsClipEmpty |
True if the clip region is empty. |
PixelOffsetMode |
Indicates how pixels are offset when drawn, affecting both drawing quality and speed. |
SmoothingMode |
Sets the quality for rendering with this Graphics object. |
Method |
Means |
---|---|
Clear |
Clears the drawing surface, filling it with the background color. |
Dispose |
Deletes and deallocates this Graphics object. |
DrawArc |
Draws an arc. |
DrawBezier |
Draws a Bézier curve. |
DrawBeziers |
Draws Bézier curves. |
DrawClosedCurve |
Draws a closed curve. |
DrawCurve |
Draws a curve. |
DrawEllipse |
Draws an ellipse. |
DrawIcon |
Draws an icon. |
DrawIconUnstretched |
Draws an icon without scaling the icon. |
DrawImage |
Draws an image. |
DrawImageUnscaled |
Draws an image without scaling the image. |
DrawLine |
Draws a line. |
DrawLines |
Draws lines. |
DrawPath |
Draws a graphics path. |
DrawPie |
Draws a pie section. |
DrawPolygon |
Draws a polygon. |
DrawRectangle |
Draws a rectangle. |
DrawRectangles |
Draws rectangles. |
DrawString |
Draws a text string. |
FillClosedCurve |
Fills a closed curve. |
FillEllipse |
Fills an ellipse. |
FillPath |
Fills the inside of a path. |
FillPie |
Fills a pie section. |
FillPolygon |
Fills a polygon. |
FillRectangle |
Fills a rectangle. |
FillRectangles |
Fills rectangles. |
FillRegion |
Fills the inside of a region. |
GetHdc |
Gets Windows device context handle for this Graphics object. |
GetNearestColor |
Gets the nearest color to a given color. |
MeasureString |
Gets the length of a string to display. |
Save |
Saves this object as a GraphicsState object. |
SetClip |
Sets the clipping region. |
![]() ![]() | ||