private System.Drawing.Image CreateMetafile(string suffix) { string extension = Path.GetExtension(FileName); string fileName = Path.ChangeExtension(FileName, suffix + extension); System.Drawing.Image image; using (Bitmap bmp = new Bitmap(1, 1)) using (Graphics g = Graphics.FromImage(bmp)) { IntPtr hdc = g.GetHdc(); if (suffix == "") { image = new Metafile(Stream, hdc); } else { image = new Metafile(fileName, hdc); if (!GeneratedFiles.Contains(fileName)) { GeneratedFiles.Add(fileName); } } g.ReleaseHdc(hdc); } return(image); }