---
title: "GdiGraphics Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# GdiGraphics Class
 
This class represents drawing functionality provided with Graphics Mill for .NET.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Class GdiGraphics _Inherits UnitConverterObject
```
 
```csharp
public class GdiGraphics : UnitConverterObject
```
 
## Remarks
 This class enables you to draw lines, curves, and shapes as well as text at the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) 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. 
- **[DrawArc()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawArc.htm.md)**Draws an arc.
- **[DrawBezier()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawBezier.htm.md)**Draws a Bezier spline.
- **[DrawEllipse()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawEllipse.htm.md)**Draws an outline for ellipse.
- **[DrawLine()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawLine.htm.md)**Draws a line.
- **[DrawPie()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawPie.htm.md)**Draws an outline for a pie.
- **[DrawLines()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawLines.htm.md)**Draws a polyline.
- **[DrawPolygon()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawPolygon.htm.md)**Draws an outline for polygon.
- **[DrawRectangle()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawRectangle.htm.md)**Draws an outline for a rectangle.

Filling methods are drawing filled shapes without outline:

- **[FillEllipse()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_FillEllipse.htm.md)**Draws a filled ellipse.
- **[FillPie()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_FillPie.htm.md)**Draws a filled pie.
- **[FillPolygon()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_FillPolygon.htm.md)**Draws a filled polygon.
- **[FillRectangle()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_FillRectangle.htm.md)**Draws a filled rectangle.

This class also provides wide functionality for text output. There are a number of overloads of the [DrawString()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString.htm.md) method: [draw simple string filled with solid color](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString_5_aeafd127.htm.md), [draw outlined text](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString_6_07649334.htm.md), [draw multiline text](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString_11_d5226568.htm.md), etc.

Also, you can draw image through this class. It can be done with overloads of the [DrawImage()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawImage.htm.md) 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()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_SetClip.htm.md) method, and apply set-theory operations ([IntersectClip()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_IntersectClip.htm.md) and [ExcludeClip()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_ExcludeClip.htm.md) methods), reset clipping region ([ResetClip()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_ResetClip.htm.md)), move it ([TranslateClip()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_TranslateClip.htm.md)), etc.

If GdiGraphics features are not enough for you, you can use a power of Windows GDI. Using [GetHdc()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_GetHdc.htm.md) method you can get a HDC this graphics represents, and use it in GDI functions.

**Note**
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](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_UnsupportedPixelFormatException.htm.md) exception will be thrown.
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.LockableObject](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_LockableObject.htm.md)
        - [Aurigma.GraphicsMill.UnitConverterObject](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_UnitConverterObject.htm.md)
            - Aurigma.GraphicsMill.Drawing.GdiGraphics
 
## 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

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_306.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_307.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_308.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_309.png)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_310.png)
  
## See Also

### Reference

- [GdiGraphics Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
