Click or drag to resize
ReaderWmfRead Method
Reads metafile (emf or wmf) and returns System.Windows.Controls.Viewbox with elements as Shapes (Path, Ellipse, Polyline, etc.) and TextBlocks (for texts).
Overload List
  NameDescription
Public methodCode exampleRead(Stream)
Reads metafile (emf or wmf) from stream and returns System.Windows.Controls.Viewbox with elements as Shapes (Path, Ellipse, Polyline, etc.) and TextBlocks (for texts).
Public methodCode exampleRead(String)
Reads metafile (emf or wmf) and returns System.Windows.Controls.Viewbox with elements as Shapes (Path, Ellipse, Polyline, etc.) and TextBlocks (for texts).
Top
Remarks

Because Shapes are derived from the FrameworkElement class, Shape objects can be used inside panels and most controls. This means it is very simple to add events to elements, change elements properties or otherwise manipulate with elements. But for more complex images this could affect performance and can add significantly more memory consumption in your application.

For better performance it is better to use ReadGeometry method that returns elements as Drawing objects. It is also possible to further optimize the returned Drawing objects with GeometrySettings.

Examples
The following sample reads the mySample.wmf file into sampleViewbox Viewbox:
Viewbox sampleViewbox = myReader.Read(@"c:\mySample.wmf");
The following sample shows how to read metafile from Application's Resource (mySample.emf file is included into the project under cliparts folder and its build action is set to Resource).
Viewbox clipartFromResource;
Uri uri = new Uri("/cliparts/mySample.emf", UriKind.Relative);
using (Stream metafileStream = Application.GetResourceStream(uri).Stream)
{
    clipartFromResource = Ab2d.ReaderWmf.Instance.Read(metafileStream);
}
See Also