: Dim Bmp as Bitmap
: Dim Bmp2 as Bitmap
: Bmp = Bmp2
:
: ?
:
:
Hi Sean,
That was the first thing I tried, and it had no effect. I assumed that because I didn't use a graphics object to draw the one Bitmap to the other that the code was just Null. I'm just guessing.
What I'm trying to do is create an Undo function for a drawing program I wrote.
So my logic goes - Make a Bitmap copy of what's happening on the screen, called BMPundo1, and when the User hits 'Undo' replace the Bitmap shown on the screen, called BMPwithGL, with BMPundo1.
One problem I've had while trying to figure this out is that several versions of code I've found that succeeds in doing what I want, lock up the target Bitmap objects. preventing me from accessing them any further. To clarify, I am able to draw OK, then I hit Undo, the image changes properly to the stored 'Undo Image', now I can no longer Draw, or Clear the screen, etc.
The following code seems to work, but I'm not sure if it's proper or the best.
Private Sub StoreUndo()
BMPundo1 = DirectCast(BMPwithGL.Clone, Bitmap)
End Sub
Private Sub btnUndo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUndo.Click
Dim BMPwithGL As Bitmap = BMPundo1
PictureBox1.Image = BMPwithGL
End Sub