Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Button with Bitmap Image

Button with Bitmap Image

Scheduled Pinned Locked Moved C / C++ / MFC
graphicslearningc++helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Clump
    wrote on last edited by
    #1

    Hi everyone. I know this is a bit of a beginner question, but I never had to do this task before and am a bit confused as the best way to do it. I have a button on a dialog, which I want to place a bitmap on (specifically, the little printer bitmap under the graphics/bitmaps directory of VC++). I can either make a CButton object, and do it this way, or use CBitmapButton. I want the button to work like a toolbar button (that is, in the way it looks, and the fact only 1 bitmap is used for all button states, not the up to 4 that CBitmapButton uses). I was going to use a CButton and place a bitmap on it, but I couldn't figure out how to get my bitmap (which is in the resource file as IDC_BMP_BITMAP) into an HBITMAP parameter, which CButton requires. I tried using CBitmap to get a HBITMAP handle back, but I couldn't quite figure out how to do this. I am sure this is a simple procedure, but it has me stumped tonight :rolleyes: Thanks in advance for any help!

    M G 2 Replies Last reply
    0
    • J John Clump

      Hi everyone. I know this is a bit of a beginner question, but I never had to do this task before and am a bit confused as the best way to do it. I have a button on a dialog, which I want to place a bitmap on (specifically, the little printer bitmap under the graphics/bitmaps directory of VC++). I can either make a CButton object, and do it this way, or use CBitmapButton. I want the button to work like a toolbar button (that is, in the way it looks, and the fact only 1 bitmap is used for all button states, not the up to 4 that CBitmapButton uses). I was going to use a CButton and place a bitmap on it, but I couldn't figure out how to get my bitmap (which is in the resource file as IDC_BMP_BITMAP) into an HBITMAP parameter, which CButton requires. I tried using CBitmap to get a HBITMAP handle back, but I couldn't quite figure out how to do this. I am sure this is a simple procedure, but it has me stumped tonight :rolleyes: Thanks in advance for any help!

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      Have a look at the fantastic CButtonST http://www.codeproject.com/buttonctrl/cbuttonst.asp Michael :-) Communication is the first step towards enlightenment.

      1 Reply Last reply
      0
      • J John Clump

        Hi everyone. I know this is a bit of a beginner question, but I never had to do this task before and am a bit confused as the best way to do it. I have a button on a dialog, which I want to place a bitmap on (specifically, the little printer bitmap under the graphics/bitmaps directory of VC++). I can either make a CButton object, and do it this way, or use CBitmapButton. I want the button to work like a toolbar button (that is, in the way it looks, and the fact only 1 bitmap is used for all button states, not the up to 4 that CBitmapButton uses). I was going to use a CButton and place a bitmap on it, but I couldn't figure out how to get my bitmap (which is in the resource file as IDC_BMP_BITMAP) into an HBITMAP parameter, which CButton requires. I tried using CBitmap to get a HBITMAP handle back, but I couldn't quite figure out how to do this. I am sure this is a simple procedure, but it has me stumped tonight :rolleyes: Thanks in advance for any help!

        G Offline
        G Offline
        GUEJO
        wrote on last edited by
        #3

        I used a class very very useful : CxSkinButton If you want to have button of every shape and bitmap, try this link and I think you'll be surprised...;) http://www.codeproject.com/buttonctrl/CxSkinButton.asp Maybe you could tell me something too ?... Actually I'm trying to display more than one bmp at the same location but it doesn't work properly... I use the SetWindowPos function to place the bitmap and stretch it (or shrink it) to the correct size. It works well for the position and the size but not for the Z-Order (the first is over the second and I want the contrary). Setting the first parameter of the SetWindowPos to '&wndTop' does not change anything. If you could help me... Should computing stay as a source of benefit or become like knowledge : free and opened to every one ?...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups