471,337 Members | 978 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Metafile resolution

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();

Jan 10 '06 #1
0 1647

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Julian Ziersch | last post: by
1 post views Thread by sendhil | last post: by
3 posts views Thread by Richard Skopal | last post: by
2 posts views Thread by George Yefchak | last post: by
2 posts views Thread by NickP | last post: by
2 posts views Thread by Laurent Navarro | last post: by
1 post views Thread by bern11 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.