Show / Hide Table of Contents

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();
Inheritance
object
AbstractCanvas
SystemDrawingCanvas
MetafileCanvas
Implements
ICanvas
IDisposable
Inherited Members
SystemDrawingCanvas.InitGraphics(Graphics, bool, float)
SystemDrawingCanvas.SetOffset(float, float)
SystemDrawingCanvas.Close()
SystemDrawingCanvas.SetTransformation(double, double, double, double, double)
SystemDrawingCanvas.StartPath()
SystemDrawingCanvas.CloseSubpath()
SystemDrawingCanvas.MoveTo(double, double)
SystemDrawingCanvas.LineTo(double, double)
SystemDrawingCanvas.AddRectangle(double, double, double, double)
SystemDrawingCanvas.CubicCurveTo(double, double, double, double, double, double)
SystemDrawingCanvas.FillPath(int, bool)
SystemDrawingCanvas.StrokePath(double, int, LineStyle, bool)
SystemDrawingCanvas.PutText(string, double, double, int, bool)
AbstractCanvas.MmToPt
AbstractCanvas.FontMetrics
AbstractCanvas.SetupFontMetrics(string)
AbstractCanvas.PutTextLines(string[], double, double, int, double)
AbstractCanvas.Ascender(int)
AbstractCanvas.Descender(int)
AbstractCanvas.LineHeight(int)
AbstractCanvas.TextWidth(string, int, bool)
AbstractCanvas.SplitLines(string, double, int)
AbstractCanvas.Dispose()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Codecrete.SwissQRBill.Windows
Assembly: Codecrete.SwissQRBill.Windows.dll
Syntax
public class MetafileCanvas : SystemDrawingCanvas, ICanvas, IDisposable

Constructors

| Edit this page View Source

MetafileCanvas(double, double, string)

Creates a new canvas.

Declaration
public MetafileCanvas(double width, double height, string fontFamilyList)
Parameters
Type Name Description
double width

Width of resulting bitmap, in mm

double height

Height of resulting bitmap, in mm

string fontFamilyList

A list font family names, separated by comma (same syntax as for CSS). The first installed font family will be used.

Methods

| Edit this page View Source

Dispose(bool)

Frees and releases resources.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

indicates whether the method is called from a Dispose method (true) or from a finalizer (false).

Overrides
SystemDrawingCanvas.Dispose(bool)
| Edit this page View Source

SaveAs(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
string path

The path (file name) to write to.

| Edit this page View Source

ToByteArray()

Returns the result as a byte array.

Declaration
public override byte[] ToByteArray()
Returns
Type Description
byte[]

The result.

Overrides
SystemDrawingCanvas.ToByteArray()
| Edit this page View Source

ToMetafile()

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
Metafile

The metafile.

| Edit this page View Source

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
Stream stream

The stream to write to.

Implements

ICanvas
IDisposable
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX