Graphics.GetDC Method

Gets the handle to the device context associated with this Graphics.

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

Syntax

C#
public IntPtr GetDC()

Return Value

Handle to the device context associated with this Graphics.

Remarks

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

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

Unlike analogue method in Graphics, you still can call other methods of Graphics. 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

Reference