Thread: PNG image as button background

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155

    PNG image as button background

    Hey,

    I'm trying to use a PNG image (with transparency) as a button background image. I tried using this to accomplish the task, however it just leaves a blank box on the window and only highlights once before disappearing.

    I honestly don't understand why it is so difficult to get this to work, I can easily draw the dialog background (a .png) with the GDI+ in 4 lines of code, I have no clue how to create a button with a png background though.

    Any help would be greatly appreciated.

    Thanks,

    Matt
    ~guitarist809~

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by guitarist809 View Post
    I can easily draw the dialog background (a .png) with the GDI+ in 4 lines of code, I have no clue how to create a button with a png background though.
    Same way, with GDI+.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    Hey,

    I actually got that far, but ran into another problem. When I click the button it just draws over it with the clicked state (another png image with transparency) resulting in a messed up image since the old state is still there under the new image. Is there a way to delete the old button drawn by GDI+ before its drawn over?

    Thanks,

    -Matt
    ~guitarist809~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  3. png Image Resize
    By bhupesh.kec in forum C Programming
    Replies: 3
    Last Post: 12-06-2007, 07:52 AM
  4. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  5. Button Displaying Image
    By mrafcho001 in forum Windows Programming
    Replies: 4
    Last Post: 12-03-2005, 02:14 PM