Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. I have this problem.
I want to draw text to an image, but at the end.

But how can i find the real size of the metafile?

what I am doing is this:

C#
FileStream fs = new FileStream("1.emf", FileMode.Open);

          Metafile  m= new Metafile(fs);

           fs.Close();
           Graphics grfxVideo = CreateGraphics();
           IntPtr ipHdc = grfxVideo.GetHdc();
           Metafile mf = new Metafile("2.emf", ipHdc);
           grfxVideo.ReleaseHdc(ipHdc);
           Font newFont = new Font("Arial", 16, FontStyle.Bold);
           Graphics grfxMetafile = Graphics.FromImage(mf);



           grfxMetafile.DrawImage(m, 0, 0); //now 2.emf is the same with 1.emf


           int y = m.Height;


           float y1 = m.VerticalResolution;
          // SizeF size = m.PhysicalDimension;
           float testx = grfxMetafile.DpiX / 25.4f;
           grfxMetafile.DrawString("test message", SystemFonts.DefaultFont, SystemBrushes.Desktop,
               new PointF(0,y-100);
           //pictureBox1.Image = mf;

           grfxVideo.Dispose();
           mf.Dispose();
           grfxMetafile.Dispose();
           m.Dispose();


But the new emf file (2.emf) is very very long. So how can i find the end of the file, in order to draw text at it?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900