Windows Forms drawing not saving
When im drawing on the picturebox (pageImage) and im saving, the data is not saved
12 Replies
how i create Graphics instance
look at PageImage_MouseUp event
im able to draw on the window, but when it comes to save, it does not work
isDrawing
ever get set to false?the image does not change, it keep original and the drawing does not affect
like on the picturebox i see that i drew but when it comes to save it to a file the changes dont applies
When you are drawing, I believe the drawing data gets saved to the
g
object. When you save, it looks like you're just saving the page but that doesn't contain the data which you drew
Maybe I'm wrong?i think so, but then how can i save the Graphics too?
Are you able to convert
g
to a bitmap or image object?uh i think
Stack Overflow
Convert graphics object to bitmap object
How can I convert graphics object to bitmap object using C#?
Graphics Class (System.Drawing)
Encapsulates a GDI+ drawing surface. This class cannot be inherited.
Check out the documentation, I'm sure one of the methods will help you out here
The second answer in the stackoverflow page sounds promising:
Bitmap bmp = new Bitmap(100,100,graphics);
@MonJamp it just save a blank page
Bitmap bitmap = new Bitmap(pageImage.Width, pageImage.Height, g);
without the drawing
man idk
thank you for trying to help
For sure
There are many different ways you could go about to implement this, I'm not too familiar with how to use the
Graphics
object but maybe the best approach would be to save the pixel data in an array as you're drawing - just an idea
Good luck