Class MetafileCanvas
Canvas for generating Windows Metafiles (EMF).
For this class to generate correct EMF files, the application must be configured to be
*dpiAware*, either by adding an application manifest and uncommenting the relevant section
or by calling SetProcessDPIAware()
at application start.
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
Inherited Members
Namespace: Codecrete.SwissQRBill.Windows
Assembly: Codecrete.SwissQRBill.Windows.dll
Syntax
public class MetafileCanvas : SystemDrawingCanvas, ICanvas, IDisposable
Constructors
| Improve this Doc View SourceMetafileCanvas(Double, Double, String)
Creates a new canvas.
Declaration
public MetafileCanvas(double width, double height, string fontFamilyList)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Width of resulting bitmap, in mm |
System.Double | height | Height of resulting bitmap, in mm |
System.String | fontFamilyList | A list font family names, separated by comma (same syntax as for CSS). The first installed font family will be used. |
Methods
| Improve this Doc View SourceDispose(Boolean)
Frees and releases resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | indicates whether the method is called from a |
Overrides
| Improve this Doc View SourceSaveAs(String)
Writes the enhanced metafile (EMF) to the specified file path.
The canvas can no longer be used for drawing after calling this method.
Declaration
public void SaveAs(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path (file name) to write to. |
ToByteArray()
Returns the result as a byte array.
Declaration
public override byte[] ToByteArray()
Returns
Type | Description |
---|---|
System.Byte[] | The result. |
Overrides
| Improve this Doc View SourceToMetafile()
Returns the result as a metafile instance.
The caller must take ownership of the metafile and dispose it.
This method can only be called once. Thereafter, it is no longer possible to draw to this canvas or to call this method a second time.
Declaration
public Metafile ToMetafile()
Returns
Type | Description |
---|---|
System.Drawing.Imaging.Metafile | The metafile. |
WriteTo(Stream)
Writes the enhanced metafile (EMF) to the specified stream.
The canvas can no longer be used for drawing after calling this method.
Declaration
public void WriteTo(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to write to. |