* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.0 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|
| How to: Load and Display Metafiles | 03/30/2017 |
|
|
60af1714-f148-4d85-a739-0557965ffa73 |
How to: Load and Display Metafiles
The xref:System.Drawing.Imaging.Metafile class, which inherits from the xref:System.Drawing.Image class, provides methods for recording, displaying, and examining vector images.
Example
To display a vector image (metafile) on the screen, you need a xref:System.Drawing.Imaging.Metafile object and a xref:System.Drawing.Graphics object. Pass the name of a file (or a stream) to a xref:System.Drawing.Imaging.Metafile constructor. After you have created a xref:System.Drawing.Imaging.Metafile object, pass that xref:System.Drawing.Imaging.Metafile object to the xref:System.Drawing.Graphics.DrawImage%2A method of a xref:System.Drawing.Graphics object.
The example creates a xref:System.Drawing.Imaging.Metafile object from an EMF (enhanced metafile) file and then draws the image with its upper-left corner at (60, 10).
The following illustration shows the metafile drawn at the specified location.
[!code-csharpSystem.Drawing.WorkingWithImages#41] [!code-vbSystem.Drawing.WorkingWithImages#41]
Compiling the Code
The preceding example is designed for use with Windows Forms, and it requires xref:System.Windows.Forms.PaintEventArgs e, which is a parameter of the xref:System.Windows.Forms.Control.Paint event handler.
