using bitmap instead of button

This is a discussion on using bitmap instead of button within the Windows Programming forums, part of the Platform Specific Boards category; hi all, i wanna use bitmap image to replace button so that i can click the image to load into ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    74

    using bitmap instead of button

    hi all,
    i wanna use bitmap image to replace button so that i can click the image to load into another dialogue, is that possible to do it in mfc? i've add even handler OnStnClickedBitmap1() but it does not response when i click the image, does anyone know it? thanks!

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,609
    Create a static, put the image in it with SM_SETIMAGE, the subclass the static with SetWindowLong, and catch WM_LBUTTONDOWN messages in the new proc.
    Or you could use a regular button, and just put the image in that.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    74
    Quote Originally Posted by Yarin View Post
    Create a static, put the image in it with SM_SETIMAGE, the subclass the static with SetWindowLong, and catch WM_LBUTTONDOWN messages in the new proc.
    Or you could use a regular button, and just put the image in that.
    thanks, but how to put image on the button? i've use cbitmapbutton to set the button into cbitmapbutton but error occur said Cbitmapbutton is undeclared identifier, can anyone teach me? thanks!

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Have you added the required header


    afxext.h
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replace button with a bitmap
    By Swarvy in forum Windows Programming
    Replies: 10
    Last Post: 09-12-2008, 11:43 AM
  2. Replies: 2
    Last Post: 06-28-2008, 08:30 PM
  3. Cannot attach a bitmap to a button
    By newbyCpp in forum Windows Programming
    Replies: 5
    Last Post: 12-06-2004, 10:44 AM
  4. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  5. Displaying a seperate bitmap for each menu button
    By Magriep in forum Windows Programming
    Replies: 1
    Last Post: 03-26-2002, 10:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21