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. How to display a bitmap on the push button

How to display a bitmap on the push button

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorial
5 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.
  • Y Offline
    Y Offline
    yaminisridaran
    wrote on last edited by
    #1

    I am using CBitmapButton to display bitmap on the push button. CBitmapButton m_bitmap; m_bitmap.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, CRect(10,10,100,100), GetDc(), 1); m_bitmap.LoadBitmap(IDB_PLAY,0,0,0); This is not working S.Yamini

    N D 2 Replies Last reply
    0
    • Y yaminisridaran

      I am using CBitmapButton to display bitmap on the push button. CBitmapButton m_bitmap; m_bitmap.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, CRect(10,10,100,100), GetDc(), 1); m_bitmap.LoadBitmap(IDB_PLAY,0,0,0); This is not working S.Yamini

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      If you are in VC++ try with create the CBitmapButton in your resource editor, set the Bitmap there, and then when you make click on the button set the property to visible as you want. If not... With your code you are creating the bitmap and loading in the button but, are u sure that your GetDC () is pointing where you need? Take a look step by step with the debugger

      Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

      Y 1 Reply Last reply
      0
      • N Nelek

        If you are in VC++ try with create the CBitmapButton in your resource editor, set the Bitmap there, and then when you make click on the button set the property to visible as you want. If not... With your code you are creating the bitmap and loading in the button but, are u sure that your GetDC () is pointing where you need? Take a look step by step with the debugger

        Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

        Y Offline
        Y Offline
        yaminisridaran
        wrote on last edited by
        #3

        thanks. It works now S.Yamini

        N 1 Reply Last reply
        0
        • Y yaminisridaran

          thanks. It works now S.Yamini

          N Offline
          N Offline
          Nelek
          wrote on last edited by
          #4

          You are wellcome ;)

          Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

          1 Reply Last reply
          0
          • Y yaminisridaran

            I am using CBitmapButton to display bitmap on the push button. CBitmapButton m_bitmap; m_bitmap.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, CRect(10,10,100,100), GetDc(), 1); m_bitmap.LoadBitmap(IDB_PLAY,0,0,0); This is not working S.Yamini

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

            yaminisridaran wrote:

            This is not working

            See here for one that does.


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            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