Thread: Remove Image for button

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    59

    Remove Image for button

    I have set a backgroundimage to a button and wonder how it would be possible to remove this image programatically.
    I have tried to search all members but cant find any clue to how to do it.

    //Asign backgroundimage
    Code:
    button1->BackgroundImage = Image::FromFile("C:\\picture.JPG");

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    This is Visual C++ with Windows Form?
    Well, try this. Save the initial value of BackgroundImage. Then restore it. My guess is that it would be NULL or something like that. But in any case that should work.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    59
    Yes that can be a good idéa, I beleive I also found a different solution to the problem where I could insert different images also.
    Code:
    Form1::BackgroundImage = Image::FromFile("C:\\pic.JPG");

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    59
    >> Save the initial value of BackgroundImage

    Actually when experimenting around I might need to save the initial value of BackgroundImage.
    The problem is that I haven´t done this before so I am not really sure of how to do. ?

    Setting it to NULL, should that be like this. If I do that my compiler says:
    cannot convert parameter 1 from 'int' to 'System:: Drawing::Image ^'
    Code:
    button5->BackgroundImage = NULL;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 12:46 PM
  3. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  4. Image rotation - doesn't always work
    By ulillillia in forum C Programming
    Replies: 12
    Last Post: 05-03-2007, 12:46 PM
  5. Replies: 4
    Last Post: 03-02-2003, 09:12 AM