Basic thing which I am currently unable to do with code in Windows Forms:

I want to remove a background image from a panel/picture box.

How do I set the BackgroundImage to nothing or remove the background in some other way?

E.G

Early in the code the background is added:

this->panel55->BackgroundImage = Image::FromFile(String::Concat(
   System::Environment::GetFolderPath
   (System::Environment::SpecialFolder::Personal),
   "\\Chess Files\\Resources\\Pieces\\Pawn_WHITE_on_WHITE.bmp"));
	this->panel55->BackgroundImageLayout = ImageLayout::Center;

How do I remove this using code later on?

Thanks in advance to anyone who helps me.

Just leave it empty

this->panel55->BackGroundImage = Image::FromFile("");

The code is untested but it should work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.