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 change a toolbar bitmap image?

How to change a toolbar bitmap image?

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

    I want to change a toolbar bitmap image Inbox to a different bitmap (or a bitmap with a very different color background) when there are messages in the Inbox. Or some way to give the user an alert that there are new messages in the Inbox. Can this be done? Elizabeth

    R 1 Reply Last reply
    0
    • E ElizabethC

      I want to change a toolbar bitmap image Inbox to a different bitmap (or a bitmap with a very different color background) when there are messages in the Inbox. Or some way to give the user an alert that there are new messages in the Inbox. Can this be done? Elizabeth

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      One quick method would be to have two cpies of the same toolbar in your resources which have the same buttons, but one has a different image. When you need to switch bitmaps, you just call pToolbar->LoadToolbar() with the correct resource id for the correct images you want. I do somehing similar in an app of mine to switch between small/large icons and it works fine. Roger Allen Sonork 100.10016 Death come early, death come late, It takes us all, there is no reason. For every purpose under heaven, To each a turn, to each a season. A time to weep and a time to sigh, A time to laugh and a time to cry, A time to be born and a time to die. Dust to dust and ashes to ashes, And so I end my song.

      E 1 Reply Last reply
      0
      • R Roger Allen

        One quick method would be to have two cpies of the same toolbar in your resources which have the same buttons, but one has a different image. When you need to switch bitmaps, you just call pToolbar->LoadToolbar() with the correct resource id for the correct images you want. I do somehing similar in an app of mine to switch between small/large icons and it works fine. Roger Allen Sonork 100.10016 Death come early, death come late, It takes us all, there is no reason. For every purpose under heaven, To each a turn, to each a season. A time to weep and a time to sigh, A time to laugh and a time to cry, A time to be born and a time to die. Dust to dust and ashes to ashes, And so I end my song.

        E Offline
        E Offline
        ElizabethC
        wrote on last edited by
        #3

        I tried out your method. However, the toolbar flashes whenever the mouse is over it. I had LoadToolBar() at ON_UPDATE_COMMAND_UI(ID_INBOX, OnUpdateInbox). The flashing is very annoying. Elizabeth

        R 1 Reply Last reply
        0
        • E ElizabethC

          I tried out your method. However, the toolbar flashes whenever the mouse is over it. I had LoadToolBar() at ON_UPDATE_COMMAND_UI(ID_INBOX, OnUpdateInbox). The flashing is very annoying. Elizabeth

          R Offline
          R Offline
          Roger Allen
          wrote on last edited by
          #4

          It sounds like you just need to add a small amount of extra processing that only calls LoadToolbar() when a change in the button state is required. That should remove the flashing in the ON_UPADTE() handler. Roger Allen - Sonork 100.10016 If your dead and reading this, then you have no life!

          E 1 Reply Last reply
          0
          • R Roger Allen

            It sounds like you just need to add a small amount of extra processing that only calls LoadToolbar() when a change in the button state is required. That should remove the flashing in the ON_UPADTE() handler. Roger Allen - Sonork 100.10016 If your dead and reading this, then you have no life!

            E Offline
            E Offline
            ElizabethC
            wrote on last edited by
            #5

            I added some lines to set state of the toolbar, but once it gets out of ON_UPDATE_COMMAND_UI, the state is reset. What I am trying to do is to set the toolbar button ID_INBOX to TBSTATE_PRESSED when there is new mail and TBSTATE_ENABLED when there is no new mail. But the toolbar keeps flashing when I move the mouse over it. Here is some code: if (pDoc->NewMail()) { if (m_wndToolBarCtrl.GetState(ID_INBOX) != TBSTATE_PRESSED) { m_wndToolBar.LoadToolBar(IDR_MAINFRAME_NEWMAIL); m_wndToolBar.GetToolBarCtrl().SetState(ID_INBOX, TBSTATE_PRESSED); } } else { if (m_wndToolBar.GetToolBarCtrl().GetState(ID_INBOX) != TBSTATE_ENABLED) { m_wndToolBar.LoadToolBar(IDR_MAINFRAME); m_wndToolBar.GetToolBarCtrl().SetState(ID_INBOX, TBSTATE_ENABLED); } } Elizabeth

            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