I have a picturebox with an image loaded. I convert it into a bitmap,
lock the bits, re-arrange the graphics, unlock the bits, and re-assign
the bitmap to the image with:
picturebox1->image = myBitmap;
Everything works great!
Question: Is the assignment statement above a copy function, or is
picturebox1->image a reference to myBitmap? I know if I change the code
as such:
picturebox1->image = myBitmap;
delete [] myBitmap;
I get invalid object errors (implying picturebox1 is a reference). But,
if I relock the bitmap, re-arrange the bits again, and unlock them
without the re-assignment, the image never updates (even when I
minimize/maximize to force a repaint) - implying picturebox1 has a copy
of the data).
So what exactly is going on here?
(By the way, by using pictureboxes and lockbits/unlockbits, I can
display & modify images without creating a graphics object or dealing
with 'Paint' events - pretty cool!).