This documentation is for the old version. Go to the latest Graphics Mill docs

GdiGraphics Class

This class represents drawing functionality provided with Graphics Mill for .NET.

Namespace: Aurigma.GraphicsMill.Drawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)


Visual Basic
Public Class GdiGraphics _
	Inherits UnitConverterObject
public class GdiGraphics : UnitConverterObject


This class enables you to draw lines, curves, and shapes as well as text at the Bitmap or device context (it can be a window, printer, etc). Drawing methods can be divided into two groups: outlining and filling ones. Outlining methods draw an outline and has a prefix Draw. E.g.

Filling methods are drawing filled shapes without outline:

This class also provides wide functionality for text output. There are a number of overloads of the DrawString() method: draw simple string filled with solid color, draw outlined text, draw multiline text, etc.

Also, you can draw image through this class. It can be done with overloads of the DrawImage() method.

Sometimes you need to prevent some parts of the bitmap or the device context to be drawn at (i.e. clip the drawing that is outside of some region). Fortunately GdiGraphics have a built-in clipping support. You can specify clipping region through the SetClip() method, and apply set-theory operations (IntersectClip() and ExcludeClip() methods), reset clipping region (ResetClip()), move it (TranslateClip()), etc.

If GdiGraphics features are not enough for you, you can use a power of Windows GDI. Using GetHdc() method you can get a HDC this graphics represents, and use it in GDI functions.


GDI cannot handle bitmaps with an alpha channel when it draws anything on it. As the high byte of 4-byte color must be zero in GDI, each pixel drawn with GDI becomes transparent. So now, if you try to call any drawing methods for the bitmaps with an alpha channel when using GDI, the UnsupportedPixelFormatException exception will be thrown.

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model

See Also