Aan
Aan

Reputation: 12890

Dispose pictureBox

I am using Winform in C++/CLI and I have pictureBox1 and I am trying to compile the following code but it fails:

pictureBox1->Image->Dispose();

the compiler tells Dispose is not a member of System::Drawing::Image I tried to use it in C# and it works:

pictureBox1.Image.Dispose();

I use MS Visual Studio 2010.

Upvotes: 0

Views: 625

Answers (1)

Rajesh Subramanian
Rajesh Subramanian

Reputation: 6490

Please try to do the following,

 delete pictureBox1->Image;   // Dispose the existing bitmap, if any

Upvotes: 1

Related Questions