P
Paul E Collins
Here's some code I'm using:
Image img = new Bitmap(32, 16);
PictureBox pic = new PictureBox();
pic.Image = img;
myForm.Controls.Add(pic);
// ... img now goes out of scope ...
I'm assuming that, when myForm gets closed, then pic is Disposed (as
part of the Controls collection) and at the same time Disposes of the
"new Bitmap" I assigned to its Image property. Is this correct, or do
I need to do something else to avoid a resource leak?
Eq.
Image img = new Bitmap(32, 16);
PictureBox pic = new PictureBox();
pic.Image = img;
myForm.Controls.Add(pic);
// ... img now goes out of scope ...
I'm assuming that, when myForm gets closed, then pic is Disposed (as
part of the Controls collection) and at the same time Disposes of the
"new Bitmap" I assigned to its Image property. Is this correct, or do
I need to do something else to avoid a resource leak?
Eq.