Am I responsible for Disposing a BackgroundImage?

Assuming that UpdateFromBackground() is called more than once, you probably should Dispose the old Image when (before) setting a new one. If you don't then the CG will do it eventually but that is less efficient. The Form will only Dispose the last BgImage you assigned private void UpdateFromBackground() { if (this.

BackgroundImage! = null) { this.BackgroundImage.Dispose(); } this. BackgroundImage = MakeCustomBackground(); }.

Assuming that UpdateFromBackground() is called more than once, you probably should Dispose the old Image when (before) setting a new one. If you don't then the CG will do it eventually but that is less efficient. The Form will only Dispose the last BgImage you assigned.

Private void UpdateFromBackground() { if (this. BackgroundImage! = null) { this.BackgroundImage.Dispose(); } this.

BackgroundImage = MakeCustomBackground(); }.

I have a windows form where I set the BackgroundImage property to a custom bitmap image. My question is, Image is disposable and I am creating it, does that mean that I must dispose of it? Or when I pass the image to the form, via BackgroundImage, does it take ownership and dispose of it when it no longer needs it?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions