Hi, i am having problems with my code currently.
What i have is a Picturebox called Canvas, and i am drawing onto it using GDI (i am writing a finite state machine application for my uni project). There is no background image (just a plain white background colour), and my objects which are redrawn every OnPaint event.
What i need to be able to do is to save an image of this canvas (preferably jpeg), to a file.
I tried to do this in a separate subroutine (menu item activate):
however, this returned and error (Object reference not set...etc) as on inspection the .image property = nothing.
so i tried to save the image in the paint event, if a flag is set. however i cannot find a way of converting my Graphics object that i am drawing on, to an image.
I have tried searching here, but no luck.
any ideas?
thanks
What i have is a Picturebox called Canvas, and i am drawing onto it using GDI (i am writing a finite state machine application for my uni project). There is no background image (just a plain white background colour), and my objects which are redrawn every OnPaint event.
What i need to be able to do is to save an image of this canvas (preferably jpeg), to a file.
I tried to do this in a separate subroutine (menu item activate):
VB.NET:
Canvas.Image.Save("", Imaging.ImageFormat.Jpeg)
so i tried to save the image in the paint event, if a flag is set. however i cannot find a way of converting my Graphics object that i am drawing on, to an image.
I have tried searching here, but no luck.
any ideas?
thanks