Thread: using bitmap instead of button

  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
    2,158
    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.

  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,868
    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, 11: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, 11:40 PM