DekGenius.com
[ Team LiB ] Previous Section Next Section

Graphicsmarshal by reference, disposable

System.Drawing (system.drawing.dll)sealed class

This class is at the heart of the drawing architecture. It encapsulates a surface on which drawing is performed.

Typically, you are passed a Graphics object in the Paint handler of a Control.

Additionally, you can use the static FromImage() method to get a Graphics surface for one of the classes derived from Image (such as Bitmap or Metafile). Any painting on that surface will be reflected in the image itself.

For interop scenarios, there are static FromHdc() and FromHwnd() methods to construct a Graphics object for a DC or Win32 window, and the corresponding GetHdc() member to retrieve a Win32 device context for the managed surface.

There are a large number of methods that allow you to paint onto the surface. They fall into four broad categories:

  • Outline drawing

  • Surface filling

  • Image compositing

  • Drawing text strings

The outline drawing methods all begin with Draw. The first parameter is a Pen object, which determines the weight, color, and style of the line itself. The remaining parameters vary with the kind of line to be drawn and define the geometric shape in question.

The surface filling methods all begin with Fill. The first parameter is a Brush object, which specifies the color and pattern that will be used to fill the surface. The remaining parameters again vary with the kind of line to be drawn and define the geometric surface to fill.

Most draw and fill methods offer both integer and floating-point versions of the parameters that allow you to define the shapes concerned—Point and PointF, Rectangle and RectangleF for example. The integer methods do not offer any performance advantage in the first release, as they are all implemented in terms of the floating-point version.

There are outline drawing methods for both open and closed geometric shapes. The surface filling methods support closed shapes only.

There are methods for Arcs (portions of an ellipse), Beziers (defined by two anchor points through which the curve passes and two control points towards which it tends but through which it does not pass—like a chain nailed at both ends, with magnets nearby), Curves (cardinal splines defined by a set of points through which the line passes and a tension parameter—like a nailed-down rubber tube), Ellipses, Straight Lines, Pies (portions of an ellipse with radial lines drawn to the center), Polygons (straight-sided geometric shapes), and Rectangles. There is also a method to paint a System.Drawing.Drawing2D.GraphicsPath object—a connected or disconnected set of these elements.

For image compositing, there are DrawIcon() and DrawImage() methods. Both also offer what are theoretically optimized unscaled versions. The Icon method is called DrawIconUnstretched(), whereas the Image method is DrawImageUnscaled(). In practice, the optimized version is actually implemented in terms of the non-optimized method, so there is no benefit to be gained in this version of the framework.

There are several overloads of the DrawImage() method, offering control over various aspects of the rendering process. In addition to allowing you to specify the source rectangle within the original image and the destination rectangle on the Graphics surface (including the GraphicsUnit of measurement for those rectangles), you can provide a System.Drawing.Imaging.ImageAttributes object to control the way the individual pixel colors are rendered for this image.

There is also an optional DrawImageAbort delegate and an IntPtr for the user data that is passed to that delegate. The underlying GDI+ rendering mechanism calls on the delegate to determine whether the long painting operation should be aborted (for example, the user has scrolled the window and you need to start painting again). The delegate returns true if the painting should be aborted, and false otherwise. If the operation aborts, a System.Runtime.InteropServices.ExternalException with the exception text "Function aborted" is thrown, so you need to put your rendering code in a try/catch block. This is a very thin wrapper over the unmanaged implementation, and should be used with caution, particularly when passing data in the IntPtr.

Text strings are drawn using the DrawString() family of methods. These typically take the string to paint, a Font with which to render the string, and a Brush that determines how the characters will be filled. Note that if you wish to paint the outline of a string rather than fill the characters, you will need to use a System.Drawing.Drawing2D.GraphicsPath and its AddString() method. You can also specify either the top-left corner of the string or its bounding Rectangle.

You can determine what the minimum containing rectangle for the string on the surface might be by calling the MeasureString() method, or MeasureCharacterRanges() to determine the bounding rectangles of various substrings within the string itself, given a particular overall layout scheme and bounding rectangle. (You might do this to calculate areas to highlight selected portions of a string, for example.)

Various aspects of the text rendering can be controlled using the StringFormat object, including line spacing, wrapping, alignment, and clipping characteristics.

There are several properties of the Graphics surface that let you control the rendering techniques used by all these methods. In each case, there is a trade-off between rendering time and image quality.

You can set the CompositingMode, which determines how source and destination pixels are combined (see System.Drawing.Drawing2D.CompositingMode for details). You can also modify the CompositingQuality, which determines the algorithm chosen to combine pixels into the surface for a particular mode (see System.Drawing.Drawing2D.CompositingQuality).

The InterpolationMode determines how pixel values are calculated during scaling and gradient operations (see System.Drawing.Drawing2D.InterpolationMode), and the PixelOffsetMode determines how pixels are translated from a sub-pixel accurate geometric world to the whole-pixel reality of the device underlying the Graphics surface.

The SmoothingMode (System.Drawing.Drawing2D.SmoothingMode) determines the antialiasing technique used for the line and curve drawing (but not text and images). Text quality is determined by the TextRenderingHint (System.Drawing.Text.TextRenderingHint). You can also set the gamma correction value for ClearType and Antialiased text rendering with the TextContrast property (an integer between 0 and 12, with 4 being the default); however, at present this does not appear to make any difference to the appearance of the rendered text.

There are three coordinate spaces in operation on a graphics surface. The World coordinate space, the Page coordinate space, and the Device coordinate space. The transform from the World coordinate space to the Page space is called the World Transform, and is stored as a System.Drawing.Drawing2D.Matrix in the Transform property. The getter for this property actually returns a copy of the Transform, rather than a reference to the transform itself, so to modify it, you need to go through a three-phase get, modify, set procedure. As this is rather inefficient, there are the MultiplyTransform(), TranslateTransform(), RotateTransform(), and ScaleTransform() methods as well.

To transform from the Page space to the Device space, you can set a GraphicsUnit in the PageUnit property, and the calibration for that unit in the PageScale property. (You can retrieve the PageScale using the DpiX and DpiY properties.)

You can also define a clipping region for the surface. The Clip property allows you to specify a Region to which the drawing is clipped. This can be a simple, complex, hollow or disconnected shape. You can also query the ClipBounds—the minimum containing rectangle of the clip region—the VisibleClipBounds, which is the intersection of the ClipBounds for the Graphics surface, and the current clip rectangle for the window to which the Graphics object is bound (if appropriate).

public sealed class Graphics : MarshalByRefObject : IDisposable {
// Public Instance Properties
   public Region Clip{set; get; }
   public RectangleF ClipBounds{get; }
   public CompositingMode CompositingMode{set; get; }
   public CompositingQuality CompositingQuality{set; get; }
   public float DpiX{get; }
   public float DpiY{get; }
   public InterpolationMode InterpolationMode{set; get; }
   public bool IsClipEmpty{get; }
   public bool IsVisibleClipEmpty{get; }
   public float PageScale{set; get; }
   public GraphicsUnit PageUnit{set; get; }
   public PixelOffsetMode PixelOffsetMode{set; get; }
   public Point RenderingOrigin{set; get; }
   public SmoothingMode SmoothingMode{set; get; }
   public int TextContrast{set; get; }
   public TextRenderingHint TextRenderingHint{set; get; }
   public Matrix Transform{set; get; }
   public RectangleF VisibleClipBounds{get; }
// Public Static Methods
   public static Graphics FromHdc(IntPtr hdc);
   public static Graphics FromHdc(IntPtr hdc, IntPtr hdevice);
   public static Graphics FromHdcInternal(IntPtr hdc);
   public static Graphics FromHwnd(IntPtr hwnd);
   public static Graphics FromHwndInternal(IntPtr hwnd);
   public static Graphics FromImage(Image image);
   public static IntPtr GetHalftonePalette();
// Public Instance Methods
   public void AddMetafileComment(byte[ ] data);
   public GraphicsContainer BeginContainer();
   public GraphicsContainer BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit);
   public GraphicsContainer BeginContainer(Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit);
   public void Clear(Color color);
   public void Dispose();  // implements IDisposable
   public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
   public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle);
   public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle);
   public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
   public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4);
   public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4);
   public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
   public void DrawBeziers(Pen pen, Point[ ] points);
   public void DrawBeziers(Pen pen, PointF[ ] points);
   public void DrawClosedCurve(Pen pen, Point[ ] points);
   public void DrawClosedCurve(Pen pen, Point[ ] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
   public void DrawClosedCurve(Pen pen, PointF[ ] points);
   public void DrawClosedCurve(Pen pen, PointF[ ] points, float tension, System.Drawing.Drawing2D.FillMode fillmode);
   public void DrawCurve(Pen pen, Point[ ] points);
   public void DrawCurve(Pen pen, Point[ ] points, int offset, int numberOfSegments, float tension);
   public void DrawCurve(Pen pen, Point[ ] points, float tension);
   public void DrawCurve(Pen pen, PointF[ ] points);
   public void DrawCurve(Pen pen, PointF[ ] points, int offset, int numberOfSegments);
   public void DrawCurve(Pen pen, PointF[ ] points, int offset, int numberOfSegments, float tension);
   public void DrawCurve(Pen pen, PointF[ ] points, float tension);
   public void DrawEllipse(Pen pen, int x, int y, int width, int height);
   public void DrawEllipse(Pen pen, Rectangle rect);
   public void DrawEllipse(Pen pen, RectangleF rect);
   public void DrawEllipse(Pen pen, float x, float y, float width, float height);
   public void DrawIcon(Icon icon, int x, int y);
   public void DrawIcon(Icon icon, Rectangle targetRect);
   public void DrawIconUnstretched(Icon icon, Rectangle targetRect);
   public void DrawImage(Image image, int x, int y);
   public void DrawImage(Image image, int x, int y, int width, int height);
   public void DrawImage(Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, Point point);
   public void DrawImage(Image image, Point[ ] destPoints);
   public void DrawImage(Image image, Point[ ] destPoints, Rectangle srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, Point[ ] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void DrawImage(Image image, Point[ ] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
        System.Drawing.Imaging.ImageAttributes imageAttr, DrawImageAbort callback);
   public void DrawImage(Image image, Point[ ] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
        System.Drawing.Imaging.ImageAttributes imageAttr, DrawImageAbort callback, int callbackData);
   public void DrawImage(Image image, PointF point);
   public void DrawImage(Image image, PointF[ ] destPoints);
   public void DrawImage(Image image, PointF[ ] destPoints, RectangleF srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, PointF[ ] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void DrawImage(Image image, PointF[ ] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
        System.Drawing.Imaging.ImageAttributes imageAttr, DrawImageAbort callback);
   public void DrawImage(Image image, PointF[ ] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
        System.Drawing.Imaging.ImageAttributes imageAttr, DrawImageAbort callback, int callbackData);
   public void DrawImage(Image image, Rectangle rect);
   public void DrawImage(Image image, RectangleF rect);
   public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, 
        GraphicsUnit srcUnit);
   public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, 
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttr, DrawImageAbort callback);
   public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, DrawImageAbort callback, 
        IntPtr callbackData);
   public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
        GraphicsUnit srcUnit);
   public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs);
   public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, DrawImageAbort callback);
   public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
        GraphicsUnit srcUnit, System.Drawing.Imaging.ImageAttributes imageAttrs, DrawImageAbort callback, 
        IntPtr callbackData);
   public void DrawImage(Image image, float x, float y);
   public void DrawImage(Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit);
   public void DrawImage(Image image, float x, float y, float width, float height);
   public void DrawImageUnscaled(Image image, int x, int y);
   public void DrawImageUnscaled(Image image, int x, int y, int width, int height);
   public void DrawImageUnscaled(Image image, Point point);
   public void DrawImageUnscaled(Image image, Rectangle rect);
   public void DrawLine(Pen pen, int x1, int y1, int x2, int y2);
   public void DrawLine(Pen pen, PointF pt1, PointF pt2);
   public void DrawLine(Pen pen, Point pt1, Point pt2);
   public void DrawLine(Pen pen, float x1, float y1, float x2, float y2);
   public void DrawLines(Pen pen, Point[ ] points);
   public void DrawLines(Pen pen, PointF[ ] points);
   public void DrawPath(Pen pen, System.Drawing.Drawing2D.GraphicsPath path);
   public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
   public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle);
   public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle);
   public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
   public void DrawPolygon(Pen pen, Point[ ] points);
   public void DrawPolygon(Pen pen, PointF[ ] points);
   public void DrawRectangle(Pen pen, int x, int y, int width, int height);
   public void DrawRectangle(Pen pen, Rectangle rect);
   public void DrawRectangle(Pen pen, float x, float y, float width, float height);
   public void DrawRectangles(Pen pen, Rectangle[ ] rects);
   public void DrawRectangles(Pen pen, RectangleF[ ] rects);
   public void DrawString(string s, Font font, Brush brush, PointF point);
   public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format);
   public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle);
   public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format);
   public void DrawString(string s, Font font, Brush brush, float x, float y);
   public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format);
   public void EndContainer(System.Drawing.Drawing2D.GraphicsContainer container);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point[ ] destPoints, 
        Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, 
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, 
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, 
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, 
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, RectangleF srcRect,
        GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, RectangleF srcRect,
        GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF[ ] destPoints, RectangleF srcRect, 
        GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, 
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, 
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, RectangleF srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, RectangleF srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, PointF destPoint, RectangleF srcRect, 
        GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, Rectangle srcRect,
        GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, Rectangle srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Point destPoint, Rectangle srcRect, 
        GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, 
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, 
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect, 
        EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect,
        EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect,
        EnumerateMetafileProc callback, IntPtr callbackData, System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect, RectangleF srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect, RectangleF srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, RectangleF destRect, RectangleF srcRect, 
        GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, Rectangle srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, Rectangle srcRect, 
        GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData);
   public void EnumerateMetafile(System.Drawing.Imaging.Metafile metafile, Rectangle destRect, Rectangle srcRect, 
        GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, 
        System.Drawing.Imaging.ImageAttributes imageAttr);
   public void ExcludeClip(Rectangle rect);
   public void ExcludeClip(Region region);
   public void FillClosedCurve(Brush brush, Point[ ] points);
   public void FillClosedCurve(Brush brush, Point[ ] points, System.Drawing.Drawing2D.FillMode fillmode);
   public void FillClosedCurve(Brush brush, Point[ ] points, System.Drawing.Drawing2D.FillMode fillmode, float tension);
   public void FillClosedCurve(Brush brush, PointF[ ] points);
   public void FillClosedCurve(Brush brush, PointF[ ] points, System.Drawing.Drawing2D.FillMode fillmode);
   public void FillClosedCurve(Brush brush, PointF[ ] points, System.Drawing.Drawing2D.FillMode fillmode, float tension);
   public void FillEllipse(Brush brush, int x, int y, int width, int height);
   public void FillEllipse(Brush brush, Rectangle rect);
   public void FillEllipse(Brush brush, RectangleF rect);
   public void FillEllipse(Brush brush, float x, float y, float width, float height);
   public void FillPath(Brush brush, System.Drawing.Drawing2D.GraphicsPath path);
   public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle);
   public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle);
   public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle);
   public void FillPolygon(Brush brush, Point[ ] points);
   public void FillPolygon(Brush brush, Point[ ] points, System.Drawing.Drawing2D.FillMode fillMode);
   public void FillPolygon(Brush brush, PointF[ ] points);
   public void FillPolygon(Brush brush, PointF[ ] points, System.Drawing.Drawing2D.FillMode fillMode);
   public void FillRectangle(Brush brush, int x, int y, int width, int height);
   public void FillRectangle(Brush brush, Rectangle rect);
   public void FillRectangle(Brush brush, RectangleF rect);
   public void FillRectangle(Brush brush, float x, float y, float width, float height);
   public void FillRectangles(Brush brush, Rectangle[ ] rects);
   public void FillRectangles(Brush brush, RectangleF[ ] rects);
   public void FillRegion(Brush brush, Region region);
   public void Flush();
   public void Flush(System.Drawing.Drawing2D.FlushIntention intention);
   public IntPtr GetHdc();
   public Color GetNearestColor(Color color);
   public void IntersectClip(Rectangle rect);
   public void IntersectClip(RectangleF rect);
   public void IntersectClip(Region region);
   public bool IsVisible(int x, int y);
   public bool IsVisible(int x, int y, int width, int height);
   public bool IsVisible(Point point);
   public bool IsVisible(PointF point);
   public bool IsVisible(Rectangle rect);
   public bool IsVisible(RectangleF rect);
   public bool IsVisible(float x, float y);
   public bool IsVisible(float x, float y, float width, float height);
   public Region[ ] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat);
   public SizeF MeasureString(string text, Font font);
   public SizeF MeasureString(string text, Font font, int width);
   public SizeF MeasureString(string text, Font font, int width, StringFormat format);
   public SizeF MeasureString(string text, Font font, PointF origin, StringFormat stringFormat);
   public SizeF MeasureString(string text, Font font, SizeF layoutArea);
   public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat);
   public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, 
        out int linesFilled);
   public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix);
   public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, 
        System.Drawing.Drawing2D.MatrixOrder order);
   public void ReleaseHdc(IntPtr hdc);
   public void ReleaseHdcInternal(IntPtr hdc);
   public void ResetClip();
   public void ResetTransform();
   public void Restore(System.Drawing.Drawing2D.GraphicsState gstate);
   public void RotateTransform(float angle);
   public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order);
   public GraphicsState Save();
   public void ScaleTransform(float sx, float sy);
   public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order);
   public void SetClip(Graphics g);
   public void SetClip(Graphics g, System.Drawing.Drawing2D.CombineMode combineMode);
   public void SetClip(System.Drawing.Drawing2D.GraphicsPath path);
   public void SetClip(System.Drawing.Drawing2D.GraphicsPath path, 
        System.Drawing.Drawing2D.CombineMode combineMode);
   public void SetClip(Rectangle rect);
   public void SetClip(Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode);
   public void SetClip(RectangleF rect);
   public void SetClip(RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode);
   public void SetClip(Region region, System.Drawing.Drawing2D.CombineMode combineMode);
   public void TransformPoints(System.Drawing.Drawing2D.CoordinateSpace destSpace, 
        System.Drawing.Drawing2D.CoordinateSpace srcSpace, Point[ ] pts);
   public void TransformPoints(System.Drawing.Drawing2D.CoordinateSpace destSpace,
        System.Drawing.Drawing2D.CoordinateSpace srcSpace, PointF[ ] pts);
   public void TranslateClip(int dx, int dy);
   public void TranslateClip(float dx, float dy);
   public void TranslateTransform(float dx, float dy);
   public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order);
// Protected Instance Methods
   protected override void Finalize();  // overrides object
}

Hierarchy

System.Object System.MarshalByRefObject Graphics(System.IDisposable)

Returned By

System.Drawing.Design.PaintValueEventArgs.Graphics, System.Drawing.Printing.PrintController.OnStartPage(), System.Drawing.Printing.PrinterSettings.CreateMeasurementGraphics(), System.Drawing.Printing.PrintPageEventArgs.Graphics, System.Windows.Forms.Control.CreateGraphics(), System.Windows.Forms.DrawItemEventArgs.Graphics, System.Windows.Forms.MeasureItemEventArgs.Graphics, System.Windows.Forms.PaintEventArgs.Graphics

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section