public void Save(String fileName) { if (fileName.ToUpper().EndsWith("XML")) { LeMenu.ExportToXML(fileName); } else { if (Canvas is PictureBox) { PictureBox me = (Canvas as PictureBox); Image myImage = new System.Drawing.Bitmap(me.Width, me.Height); Graphics g = System.Drawing.Graphics.FromImage(myImage); g.FillRectangle(new SolidBrush(Color.White), 0, 0, me.Width, me.Height); foreach (LeShape shape in xmlShapes.GetList()) { shape.Paint(this, g); } me.Image = myImage; myImage.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg); } } }