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. Changing the Image on the Toolbar button.

Changing the Image on the Toolbar button.

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 4 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.
  • G Offline
    G Offline
    gopalraja
    wrote on last edited by
    #1

    I want to change the image of the toolbar button, that is, When I cilcked one tool bar button then I want to change the image of the button. So I have used the following code, but it saying some runtime error. CToolBarCtrl &ctrl = m_wndToolBar.GetToolBarCtrl(); ctrl.AddBitmap(3,IDB_BITMAP3); Pls provide me some solution,

    C P A 3 Replies Last reply
    0
    • G gopalraja

      I want to change the image of the toolbar button, that is, When I cilcked one tool bar button then I want to change the image of the button. So I have used the following code, but it saying some runtime error. CToolBarCtrl &ctrl = m_wndToolBar.GetToolBarCtrl(); ctrl.AddBitmap(3,IDB_BITMAP3); Pls provide me some solution,

      C Offline
      C Offline
      Chandrasekharan P
      wrote on last edited by
      #2

      try using LoadImages(). and what is this AddBitmap?

      1 Reply Last reply
      0
      • G gopalraja

        I want to change the image of the toolbar button, that is, When I cilcked one tool bar button then I want to change the image of the button. So I have used the following code, but it saying some runtime error. CToolBarCtrl &ctrl = m_wndToolBar.GetToolBarCtrl(); ctrl.AddBitmap(3,IDB_BITMAP3); Pls provide me some solution,

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #3

        gopalraja wrote:

        ctrl.AddBitmap(3,IDB_BITMAP3);

        This function is used to add bitmap to imagelist associated with toolbar control. Look at function SetImageList, and use it according to your need. Images on toolbar shown according to imagelist associated with that toolbar control.

        1 Reply Last reply
        0
        • G gopalraja

          I want to change the image of the toolbar button, that is, When I cilcked one tool bar button then I want to change the image of the button. So I have used the following code, but it saying some runtime error. CToolBarCtrl &ctrl = m_wndToolBar.GetToolBarCtrl(); ctrl.AddBitmap(3,IDB_BITMAP3); Pls provide me some solution,

          A Offline
          A Offline
          ATM CodeProject
          wrote on last edited by
          #4

          Hi, You can set cold and hot images for the toolbar. This is the sample code. CImageList img; img.Create(IDB_HOTTOOLBARS, 22, 0, RGB(128, 128, 128)); m_wndToolBars.GetToolBarCtrl().SetHotImageList(&img); img.Detach(); img.Create(IDB_COLDTOOLBAR, 22, 0, RGB(255, 255, 255)); m_wndToolBars.GetToolBarCtrl().SetImageList(&img); img.Detach(); Here m_wndToolBars is the CToolBar object.And IDB_HOTTOOLBARS and IDB_COLDTOOLBAR are the Bitmap imges in the resourse editor. Regards Arun

          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