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 ?

8 Years
Discussion Span
Last Post by Lukezzz

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?


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

>mybutton1->BackgroundImage = NULL;

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.