When drawing to a Graphics surface, i.e. when drawing to a Bitmap, you can easily crop using one of the overloads of the DrawImage() method. Here is an example where only the lower right quarter of the metafile is drawn to the bitmap:
Metafile metafile = ...;
Bitmap target = new Bitmap(1000, 1000);
using (Graphics g = Graphics.FromImage(target))
{
g.DrawImage(metafile, -1000, -1000, 2000, 2000);
g.Flush();
}
When drawing to a
Graphics
surface, i.e. when drawing to aBitmap
, you can easily crop using one of the overloads of theDrawImage()
method. Here is an example where only the lower right quarter of the metafile is drawn to the bitmap: