System.Drawing.Graphics.ReleaseHdc Method

Releases a device context handle obtained by a previous call to the Graphics.GetHdc method of this System.Drawing.Graphics.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
public void ReleaseHdc (IntPtr hdc)

Parameters

hdc
Handle to a device context obtained by a previous call to the Graphics.GetHdc method of this System.Drawing.Graphics.

Remarks

The device context is a Windows structure based on ndptecgdi that defines a set of graphical objects and their associated attributes, as well as the graphical modes that affect output.

Calls to the Graphics.GetHdc and Graphics.ReleaseHdc(IntPtr) methods must appear in pairs. During the scope of a Graphics.GetHdc and Graphics.ReleaseHdc(IntPtr) method pair, you usually make calls only to ndptecgdi functions. Calls in that scope made to ndptecgdiplus methods of the System.Drawing.Graphics that produced the hdc parameter fail with an ObjectBusy error. Also, ndptecgdiplus ignores any state changes made to the System.Drawing.Graphics of the hdc parameter in subsequent operations.

Requirements

Namespace: System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0