With this code I am setting a backgroundimage to a button.

mybutton1->BackgroundImage = Image::FromFile("D:\\pic1.JPG");

What I need to do is to also be able to remove this image from the button as it was before I did put the image to the button so the button doesn´t have any BackgroundImage.

How is this possible to do programtically ?

Recommended Answers

All 4 Replies

Set the same property to null?

I thought about that also before but if I write it like this, then I have the compiler saying this.

No user-defined-conversion operator available, or
1> No standard conversion exists from the boxed form of the arithmetic type to the target type

'System::Windows::Forms::Control::BackgroundImage::set' : cannot convert parameter 1 from 'int' to 'System:: Drawing::Image ^'

mybutton1->BackgroundImage = NULL;

Set the same property to null?

>mybutton1->BackgroundImage = NULL;
*sigh*

Thank you Narue, nullptr does work for this.
I forgot I have to use nullptr instead of NULL.


>mybutton1->BackgroundImage = NULL;
*sigh*

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.