Class SafeDeviceContextHandle
A DeviceContext SafeHandle implementation
Namespace: Dapplo.Windows.Gdi32.SafeHandles
Assembly: Dapplo.Windows.Gdi32.dll
Syntax
public class SafeDeviceContextHandle : SafeDcHandle
Constructors
| Improve this Doc View SourceSafeDeviceContextHandle()
Default constructor is needed to support marshalling!!
Declaration
public SafeDeviceContextHandle()
Methods
| Improve this Doc View SourceFromGraphics(Graphics, Boolean)
Create a SafeDeviceContextHandle from a Graphics object
Declaration
public static SafeDeviceContextHandle FromGraphics(Graphics graphics, bool disposeGraphics = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | graphics | Graphics object |
| System.Boolean | disposeGraphics |
Returns
| Type | Description |
|---|---|
| SafeDeviceContextHandle | SafeDeviceContextHandle |
FromHWnd(IntPtr)
Create a SafeDeviceContextHandle from a hWnd
Declaration
public static SafeDeviceContextHandle FromHWnd(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for hWnd |
Returns
| Type | Description |
|---|---|
| SafeDeviceContextHandle | SafeDeviceContextHandle |
ReleaseHandle()
Call graphics.ReleaseHdc
Declaration
protected override bool ReleaseHandle()
Returns
| Type | Description |
|---|---|
| System.Boolean | always true |
SelectObject(SafeHandle)
The SelectObject function selects an object into the device context (DC) which this SafeDeviceContextHandle represents. The new object replaces the previous object of the same type.
Declaration
public SafeSelectObjectHandle SelectObject(SafeHandle newHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| SafeHandle | newHandle | SafeHandle for the new object |
Returns
| Type | Description |
|---|---|
| SafeSelectObjectHandle | Replaced object |