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 Bitmaps

Button Bitmaps

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
5 Posts 5 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.
  • M Offline
    M Offline
    mavgoose
    wrote on last edited by
    #1

    Hi, i am trying to place a bitmap on a button but have had no success, i have read lots of ways of doing them and had a go at implementing them but i don't really understand about them. I was wondering if any one could explain it in simple terms maybe even give some sample code to make it easier to understand. Thanks Mav

    R T D 3 Replies Last reply
    0
    • M mavgoose

      Hi, i am trying to place a bitmap on a button but have had no success, i have read lots of ways of doing them and had a go at implementing them but i don't really understand about them. I was wondering if any one could explain it in simple terms maybe even give some sample code to make it easier to understand. Thanks Mav

      R Offline
      R Offline
      RChin
      wrote on last edited by
      #2

      Extremely simple if you are using VS6 with MFC:* Set the bitmap option of your button from the styles tab in the resource editor

      • Create a member variable of your button control using classwizard

      • In your OnInitDialog() or OnInitialUpdate() overridden function, set the bitmap of the button using the SetBitmap() member function. You will need to load your bitmap resource into a CBitmap variable for use by the button. So a sample code would look something like: .. **_// m_bmpButtonImage is a CBitmap variable_** m_bmpButtonImage.LoadBitmap(IDB_IMAGE); **_// m_cButton is the associated control variable_** m_cButton.SetBitmap(m_bmpButtonImage); ..


        I Dream of Absolute Zero

      V 1 Reply Last reply
      0
      • M mavgoose

        Hi, i am trying to place a bitmap on a button but have had no success, i have read lots of ways of doing them and had a go at implementing them but i don't really understand about them. I was wondering if any one could explain it in simple terms maybe even give some sample code to make it easier to understand. Thanks Mav

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        there is plenty of good articles on CP... ther's surely one for you : MFC Button Articles


        TOXCCT >>> GEII power

        1 Reply Last reply
        0
        • M mavgoose

          Hi, i am trying to place a bitmap on a button but have had no success, i have read lots of ways of doing them and had a go at implementing them but i don't really understand about them. I was wondering if any one could explain it in simple terms maybe even give some sample code to make it easier to understand. Thanks Mav

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          See if this helps.


          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

          1 Reply Last reply
          0
          • R RChin

            Extremely simple if you are using VS6 with MFC:* Set the bitmap option of your button from the styles tab in the resource editor

            • Create a member variable of your button control using classwizard

            • In your OnInitDialog() or OnInitialUpdate() overridden function, set the bitmap of the button using the SetBitmap() member function. You will need to load your bitmap resource into a CBitmap variable for use by the button. So a sample code would look something like: .. **_// m_bmpButtonImage is a CBitmap variable_** m_bmpButtonImage.LoadBitmap(IDB_IMAGE); **_// m_cButton is the associated control variable_** m_cButton.SetBitmap(m_bmpButtonImage); ..


              I Dream of Absolute Zero

            V Offline
            V Offline
            VBZ
            wrote on last edited by
            #5

            hi, i have tried this method but what happens is that after compiling when we run the application instead of the bitmap there is a blank button or a white button.PLease check it n tell me. vibhu

            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