Hey guys,
I have a panel in C#, where the user can draw stuff, like in Paint. So, it has graphics drawn in it by the user.
How can I save the graphics as a .png, .bmp or even .jpg?
I tried a few codes that worked and created the image but it was just a white rectangle:
Code:
I have a panel in C#, where the user can draw stuff, like in Paint. So, it has graphics drawn in it by the user.
How can I save the graphics as a .png, .bmp or even .jpg?
I tried a few codes that worked and created the image but it was just a white rectangle:
Code:
int width = panel1.Width;
int height = panel1.Height;
Bitmap bitMap = new Bitmap(width, height);
Rectangle rec = new Rectangle(0, 0, width, height);
panel1.DrawToBitmap(bitMap, rec);
bitMap.Save(saveFileDialog.FileName);