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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with CBitmapButton

Problem with CBitmapButton

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 4 Posters 2 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
    john5632
    wrote on last edited by
    #1

    I created a button using CBitmapButton and set it to BS_OWNERDRAW but it is not shown on the dialog box. CBitmapButton m_Btn1; ... ... ... m_Btn1.Create("",WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(0,10,30,50),this,IDC_BUTTON3); m_Btn1.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2,NULL,NULL);

    C R H 3 Replies Last reply
    0
    • J john5632

      I created a button using CBitmapButton and set it to BS_OWNERDRAW but it is not shown on the dialog box. CBitmapButton m_Btn1; ... ... ... m_Btn1.Create("",WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(0,10,30,50),this,IDC_BUTTON3); m_Btn1.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2,NULL,NULL);

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

      I've made a test with your code (using MSVC++ 6.0) : class CMyDialog : public CDialog { : // somewhere CBitmapButton m_Btn1; : } BOOL CMyDialog::OnInitDialog() { CDialog::OnInitDialog(); : m_Btn1.Create("",WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(0,10,30,50),this,12345); m_Btn1.LoadBitmaps(IDB_BITMAP_TEST1,IDB_BITMAP_TEST2); : return TRUE; } ... and it work's fine. Only thing is, that the button's coords a relative to the client area of the dialog ... means the button with CRect(0,10,30,50) appears in the upper left corner of the dialog. Are you sure that it is not shown ? Or is it hidden by an other control / item ? :confused:

      1 Reply Last reply
      0
      • J john5632

        I created a button using CBitmapButton and set it to BS_OWNERDRAW but it is not shown on the dialog box. CBitmapButton m_Btn1; ... ... ... m_Btn1.Create("",WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(0,10,30,50),this,IDC_BUTTON3); m_Btn1.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2,NULL,NULL);

        R Offline
        R Offline
        Rajkumar R
        wrote on last edited by
        #3

        CBitmapButton m_Btn1; may be the local variable, got destroyed when out of scope.

        1 Reply Last reply
        0
        • J john5632

          I created a button using CBitmapButton and set it to BS_OWNERDRAW but it is not shown on the dialog box. CBitmapButton m_Btn1; ... ... ... m_Btn1.Create("",WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(0,10,30,50),this,IDC_BUTTON3); m_Btn1.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2,NULL,NULL);

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          How did you declare m_Btn1?

          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