Click or drag to resize
WmfViewbox Class
WmfViewbox is a Viewbox control that enables showing Windows Metafile (wmf) and Enhanced Metafiles (emf) images in WPF and can be used in Extensible Application Markup Language (XAML). Set its Source propety to source of wmf or wmf file - use pack Uri specifications.
Inheritance Hierarchy

Namespace: Ab2d.Controls
Assembly: Ab2d.ReaderWmf (in Ab2d.ReaderWmf.dll) Version: 7.1.5512.1040
Syntax
C#
public class WmfViewbox : Viewbox, IUriContext, 
	ISupportInitialize

The WmfViewbox type exposes the following members.

Constructors
  NameDescription
Public methodWmfViewbox
Constructor
Top
Properties
  NameDescription
Public propertyInnerReaderWmf
Gets the ReaderWmf that was used to read the metafile file.
Public propertySource
Source
Top
Events
  NameDescription
Public eventMetafileLoaded
Occurs when the reading of metafile is completed.
Public eventMetafileLoading
Occurs before the reading of metafile is started.
Top
Fields
  NameDescription
Public fieldStatic memberSourceProperty
SourceProperty
Top
Remarks

The difference between WmfDrawing and WmfViewbox is that WmfViewbox gets objects as Shapes Shapes (Canvas, Path, Polyline, etc) and WmfDrawing produces Drawings (DrawingGeometry, StreamGeometry, etc). Drawings have better performance and lower memory consumption, but Shapes support more funtionality - layout, focus, mouse events, etc.

WmfViewbox can be used in xaml. If you would like to read metafile in code and need some more advanced features and options please use ReaderWmf

Examples
The following example shows myMetafile.wmf metafile inside a Grid (the matafile's BuildAction is set to Resource).
<Window x:Class="Ab2d.ReaderWmfSample"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.ReaderWmf"
        Title="Window1" Height="500" Width="500"/>
     <Grid>
         <ab2d:WmfViewbox Name="myWmfViewbox" Source="myMetafile.wmf"
                          Stretch="Uniform"/>  
     </Grid>
</Window>
See Also