So I'm making a paint app and I'm trying to save the paint on a Panel Control into a .Jpeg, however, my code doesn't work. It saves a .Jpeg image but it's just a full white image.
My Code:
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "Jpeg Image | *.jpeg";
if (dialog.ShowDialog() == DialogResult.OK)
{
Bitmap bmp = new Bitmap(pnlPaintPanel.Width, pnlPaintPanel.Height);
Rectangle rect = new Rectangle(0, 0, pnlPaintPanel.Width, pnlPaintPanel.Height);
pnlPaintPanel.DrawToBitmap(bmp, rect);
bmp.Save(dialog.FileName, ImageFormat.Jpeg);
}
The panel is defiantly painted when I try and save, can anyone help?