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. Hi-color toolbars

Hi-color toolbars

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 4 Posters 1 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.
  • H Offline
    H Offline
    Hyien
    wrote on last edited by
    #1

    How can I make use of hicolor bitmaps in my toolbars?

    T R 2 Replies Last reply
    0
    • H Hyien

      How can I make use of hicolor bitmaps in my toolbars?

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
      {
      CImageList imageList;
      CBitmap bitmap;

      bitmap.LoadBitmap(nIDBitmap);
      BITMAP bm;
      bitmap.GetBitmap(&bm);
      imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1);
      imageList.Add(&bitmap, RGB(255,0,255));
      tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList);
      imageList.Detach();
      bitmap.Detach();
      

      }

      // if you want to have 'hot' and 'cold' images
      SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
      SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);

      // if you don't want to use 'hot' images
      SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);

      Tomasz Sowinski -- http://www.shooltz.com

      - It's for protection
      - Protection from what? Zee Germans?

      A H 2 Replies Last reply
      0
      • T Tomasz Sowinski

        void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
        {
        CImageList imageList;
        CBitmap bitmap;

        bitmap.LoadBitmap(nIDBitmap);
        BITMAP bm;
        bitmap.GetBitmap(&bm);
        imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1);
        imageList.Add(&bitmap, RGB(255,0,255));
        tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList);
        imageList.Detach();
        bitmap.Detach();
        

        }

        // if you want to have 'hot' and 'cold' images
        SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
        SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);

        // if you don't want to use 'hot' images
        SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);

        Tomasz Sowinski -- http://www.shooltz.com

        - It's for protection
        - Protection from what? Zee Germans?

        A Offline
        A Offline
        alex barylski
        wrote on last edited by
        #3

        Thanx...i'll use that later to if you don't mind. :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

        1 Reply Last reply
        0
        • T Tomasz Sowinski

          void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
          {
          CImageList imageList;
          CBitmap bitmap;

          bitmap.LoadBitmap(nIDBitmap);
          BITMAP bm;
          bitmap.GetBitmap(&bm);
          imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1);
          imageList.Add(&bitmap, RGB(255,0,255));
          tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList);
          imageList.Detach();
          bitmap.Detach();
          

          }

          // if you want to have 'hot' and 'cold' images
          SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
          SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);

          // if you don't want to use 'hot' images
          SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);

          Tomasz Sowinski -- http://www.shooltz.com

          - It's for protection
          - Protection from what? Zee Germans?

          H Offline
          H Offline
          Hyien
          wrote on last edited by
          #4

          Is there a way to enable hicolor when using LoadToolBar? I dont want to create the tool bar from code.

          T 1 Reply Last reply
          0
          • H Hyien

            Is there a way to enable hicolor when using LoadToolBar? I dont want to create the tool bar from code.

            T Offline
            T Offline
            Tomasz Sowinski
            wrote on last edited by
            #5

            Use LoadToolBar first - it'll assign command IDs to buttons. Then, call the routine I've posted to change images to hicolor. Tomasz Sowinski -- http://www.shooltz.com

            - It's for protection
            - Protection from what? Zee Germans?

            1 Reply Last reply
            0
            • H Hyien

              How can I make use of hicolor bitmaps in my toolbars?

              R Offline
              R Offline
              Rashid Thadha
              wrote on last edited by
              #6

              See following article - http://www.codeproject.com/docking/toolbar\_hotbuttons.asp

              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