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. [Newbie] A button with a bitmap

[Newbie] A button with a bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
7 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
    mmica
    wrote on last edited by
    #1

    Hi all, I'm trying to set up a simple dialog with a button that has a bitmap instead of text. From the dialog editor I set the "Bitmap" option for the button and in the OnInitDialog() method of the dialog, I did the following: m_button.SetBitmap(LoadBitmap(NULL, MAKEINTRESOURCE(IDB_PLAY))); The button appears but no bitmap. Anyhelp would be GREATLY appreciated :-) Mark

    G C T P 4 Replies Last reply
    0
    • M mmica

      Hi all, I'm trying to set up a simple dialog with a button that has a bitmap instead of text. From the dialog editor I set the "Bitmap" option for the button and in the OnInitDialog() method of the dialog, I did the following: m_button.SetBitmap(LoadBitmap(NULL, MAKEINTRESOURCE(IDB_PLAY))); The button appears but no bitmap. Anyhelp would be GREATLY appreciated :-) Mark

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      Try looking here[^].


      Software Zen: delete this;

      1 Reply Last reply
      0
      • M mmica

        Hi all, I'm trying to set up a simple dialog with a button that has a bitmap instead of text. From the dialog editor I set the "Bitmap" option for the button and in the OnInitDialog() method of the dialog, I did the following: m_button.SetBitmap(LoadBitmap(NULL, MAKEINTRESOURCE(IDB_PLAY))); The button appears but no bitmap. Anyhelp would be GREATLY appreciated :-) Mark

        C Offline
        C Offline
        csc
        wrote on last edited by
        #3

        Hi Mark seems like the loaded bitmap resource is set free when your leaving the OnInitDialog(). Therefor the bitmap not appear. Try this hint to avoid that : create a member var for the bitmap in your Dialog class : class CMyDialog : public CDialog { : : private : CBitmap m_Bmp; }; and in the OnInitDialog : BOOL CMyDialog::OnInitDialog() { CDialog::OnInitDialog(); m_Bmp.LoadBitmap ( IDB_PLAY ); m_button.SetBitmap( m_Bmp ); return TRUE; }

        1 Reply Last reply
        0
        • M mmica

          Hi all, I'm trying to set up a simple dialog with a button that has a bitmap instead of text. From the dialog editor I set the "Bitmap" option for the button and in the OnInitDialog() method of the dialog, I did the following: m_button.SetBitmap(LoadBitmap(NULL, MAKEINTRESOURCE(IDB_PLAY))); The button appears but no bitmap. Anyhelp would be GREATLY appreciated :-) Mark

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

          please before asking such basic question have a look at the FAQ &&/|| (and/or ;P) at the posted articles... very thank you !


          TOXCCT >>> GEII power

          1 Reply Last reply
          0
          • M mmica

            Hi all, I'm trying to set up a simple dialog with a button that has a bitmap instead of text. From the dialog editor I set the "Bitmap" option for the button and in the OnInitDialog() method of the dialog, I did the following: m_button.SetBitmap(LoadBitmap(NULL, MAKEINTRESOURCE(IDB_PLAY))); The button appears but no bitmap. Anyhelp would be GREATLY appreciated :-) Mark

            P Offline
            P Offline
            Prakash Nadar
            wrote on last edited by
            #5

            Which moron gave you one.

            M 1 Reply Last reply
            0
            • P Prakash Nadar

              Which moron gave you one.

              M Offline
              M Offline
              mmica
              wrote on last edited by
              #6

              What do you mean?

              P 1 Reply Last reply
              0
              • M mmica

                What do you mean?

                P Offline
                P Offline
                Prakash Nadar
                wrote on last edited by
                #7

                Some moron had rated your question as 1.

                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