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

GdiGraphics.GetHdc Method

Gets the handle to the device context (HDC) associated with this GdiGraphics object.

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


Visual Basic
Public Function GetHdc As IntPtr
public IntPtr GetHdc()

Return Value

HDC associated with this GdiGraphics object.


Using this method you can get access to Windows GDI-based structure called device context. It enables you to use the GdiGraphics object with WinAPI functions.

You should never release this HDC with external means. This GdiGraphics will release it internally when being freed. It also means that this HDC is valid only while this GdiGraphics class instance is alive. If the GdiGraphics is created at the Bitmap, this bitmap also should be alive.

Unlike analogue method in Graphics, you still can call other methods of GdiGraphics. Moreover you can call this method multiple times (it will return the same value). However you should provide thread safety for access to this HDC.

See Also