I've created program for drawing. It uses System.graphics to draw rectangles etc. on panel1 in form. Graphics Mouse draw event: Draw I want to get art from panel1 as a bitmap, tried this code:
using (var bmp = new Bitmap(panel1.Width, panel1.Height))
{
panel1.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("output.png", System.Drawing.Imaging.ImageFormat.Jpeg);
}
but it generates background color of panel1 in image