Hi,

I have a problem with the quality from metafiles rendered on a
System.Drawing.Bitmap. In particular, text is drawn poorly. If the same
metafile is rendered directly onto a form's drawing surface, the quality is
fine. There's also a problem with scaling, with a difference in size between
the bitmap and directly drawn versions.

The code below illustrates the problem. It draws a string three times. The
top one is the string drawn directly on the form. The middle one is from a
metafile (with the string drawn onto it) drawn directly onto the form. The
bottom one is from the same metafile, rendered onto a bitmap, which is then
drawn onto the form. Top two look fine, bottom one not so good. Any ideas
what I'm doing wrong?

Thanks,
Chris.

Bitmap bitmap;
Metafile metafile;

private void button1_Click(object sender, EventArgs e)
{
using (Graphics formGraphics = CreateGraphics())
{
IntPtr handle = formGraphics.GetHdc();
metafile = new Metafile(handle, EmfType.EmfOnly);
formGraphics.ReleaseHdc();

using (Graphics metaGraphics = Graphics.FromImage(metafile))
{
metaGraphics.DrawString("Test string", new Font("Arial",
14), Brushes.Black, new PointF(0, 0));
}

bitmap = new Bitmap(400, 100);
bitmap.SetResolution(formGraphics.DpiX, formGraphics.DpiY);

using (Graphics bitmapGraphics = Graphics.FromImage(bitmap))
{
bitmapGraphics.DrawImage(metafile, new Point(0, 0));
}

formGraphics.DrawString("Test string", new Font("Arial",
14), Brushes.Black, new PointF(0, 0));
formGraphics.DrawImage(metafile, new Point(0, 50));
formGraphics.DrawImage(bitmap, new Point(0, 100));
}
}