public Metafile GetMetafile(EmfType type)
{
int w = this.ClientRectangle.Width;
int h = this.ClientRectangle.Height;
Metafile metafile;
using (var g = CreateGraphics())
{
IntPtr hdc = g.GetHdc();
metafile = new Metafile(hdc, type);
g.ReleaseHdc(hdc);
}
using (var g = Graphics.FromImage(metafile))
DoPaint(g, w, h);
return metafile;
}