[]
        
(Showing Draft Content)

C1.Win.Document.GraphicsHolder

GraphicsHolder Class

Holds a Graphics object together with (printer) device or bitmap that was used to create it, if any. The point is to dispose the device or bitmap together with the graphics when it is no longer needed (i.e. to avoid resource leaks).

Inheritance
GraphicsHolder
Implements
Namespace: C1.Win.Document
Assembly: C1.Win.Document.10.dll
Syntax
public class GraphicsHolder : Object, IDisposable
Public Class GraphicsHolder
    Inherits Object
    Implements IDisposable

Fields

Name Description
Empty

An empty graphics holder instance.

Properties

Name Description
DpiX

Gets the horizontal resolution of graphics held by the current instance.

DpiY

Gets the vertical resolution of graphics held by the current instance.

Graphics

Gets the graphics object held by the current instance.

Methods

Name Description
Dispose()

Disposes the current graphics holder.

Dispose(bool)

Disposes the current graphics holder.

Finalize()
FromBitmap()

Creates a graphics holder from a bitmap. The graphics and the bitmap are released when the holder is disposed. This should never fail.

FromDC(IntPtr)

Creates a graphics holder from a device context. When the holder is disposed, both graphics and the device context are released (DeleteDC is called on the device context).

FromDevice(MeasurementDevice, string, out MeasurementDevice, out string)

Creates a graphics holder from a printer or screen device contexts, depending on passing parameters. When the holder is disposed, both graphics and the device context are released (DeleteDC is called on the device context). If printerName is null or specifies invalid printer name then printer will be autoselected from list of available printers, if no printers are installed then FromScreen() method will be called.

FromGraphics(Graphics)

Creates a graphics holder from a graphics instance. When the holder is disposed, the graphics is left alone (i.e. NOT disposed).

FromScreen()

Creates a graphics holder from screen. If that fails (e.g. on Azure), the graphics is created from a bitmap. When the holder is disposed, both graphics and the bitmap are released.