Metafile resolution

W

weiruic

I am trying to create a metafile (.emf) on the harddisk, write graphics
from a graphics object to it, and then save it. I can do this
successfully except I cannot set the horizontal and vertical resolution
as those properties of my metafile object are read only and are in fact
null until the graphics object is disposed of and the file is saved.
When I examine the saved file's properties in Windows Explorer, it has
81 dpi horizontal and vertical resolution, but I did not set these. Any
suggestions? In my case, I want to set the dpi to 96 horizontal and
vertical. Thanks...

(Here is my code:)

Graphics g = Graphics.FromImage(new Bitmap(1, 1));
IntPtr hdc = g.GetHdc();

Metafile mf = new Metafile(@"c:\file.emf", hdc);

g.ReleaseHdc(hdc);
g.Dispose();

g = Graphics.FromImage(mf);
//init pens
//draw stuff
g.Dispose();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top