Export (0) Print
Expand All

Loading and Displaying Metafiles

The Metafile class, which inherits from the Image class, provides methods for recording, displaying, and examining vector images.

To display a vector image (metafile) on the screen, you need a Metafile object and a Graphics object. Pass the name of a file (or a stream) to a Metafile constructor. After you have created a Metafile object, pass that Metafile object to the DrawImage method of a Graphics object.

The following example creates a Metafile object from an EMF (enhanced metafile) file and then draws the image with its upper-left corner at (60, 10):

Dim metafile As New Metafile("SampleMetafile.emf")
e.Graphics.DrawImage(metafile, 60, 10)
Metafile metafile = new Metafile("SampleMetafile.emf");
e.Graphics.DrawImage(metafile, 60, 10);

The following illustration shows the metafile drawn at the specified location.


© 2014 Microsoft