Picture Box

lothos12345

Well-known member
Joined
May 2, 2002
Messages
294
Location
Texas
I have developed a Visual Basic.NET application, with a picture box on the main form. I user aquires and image and it loads into the PictureBox, the User can then draw lines, rectangles etc.. using the mouse on the picture box image. The problem comes in when the user scrolls down on the image the marks they previously made disappear. How can I prevent this from happening? Any help is greatly appreciated.
 
You want to store everything you draw onto a bitmap image thats not connected to the picturebox so it wont refresh and delete everything you drew.

Basically:

Code:
dim buff as bitmap = new bitmap(picturebox.width, picturebox.height)
dim g as graphics = graphics.fromimage(buff)
 
blah, use g to draw some stuff to buff instead of using it to draw to picturebox.  

picturebox.image = buff

Or something similar to that.
 
Back
Top