2

I want to add some text to a metafile.
The code i use:

Metafile m = new Metafile("1.emf");
Graphics grfxVideo = CreateGraphics();
IntPtr ipHdc = grfxVideo.GetHdc();
Metafile mf = new Metafile("2.emf", ipHdc);
grfxVideo.ReleaseHdc(ipHdc);
grfxVideo.Dispose();
Graphics grfxMetafile = Graphics.FromImage(mf);
grfxMetafile.DrawImage(m, 0, 0);
grfxMetafile.DrawString("test",SystemFonts.DefaultFont,SystemBrushes.Desktop,new PointF(0,0));
grfxMetafile.Dispose();
mf.Dispose();
m.Dispose();

The letters at the new metafile (2.emf) is more bold than the original emf file. Also the new metafile is at least twice the size of the original. What am i doing wrong?

Edit: the original emf file (1.emf) is created from an emf spool file and the text is inside the ExtTextOutW and ExtTextOutA records.

Maerlyn
  • 33,687
  • 18
  • 94
  • 85
sgkin
  • 113
  • 2
  • 7
  • Observing pretty much similar behavior which breaks my attempts to use metafiles for caching complicated graphics in my application. – olegz Aug 27 '12 at 08:18

0 Answers0