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. larger toolbar images

larger toolbar images

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
4 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.
  • J Offline
    J Offline
    josip cagalj
    wrote on last edited by
    #1

    Hi to all. Is it possible to have a 32x32 images on toolbar while keeping 16x16 in menu. I created toolbar resource (IDR_TOOLBAR1) and set it's button size as 32x32 and load it:

    if (!m_wndToolBar.CreateEx(this,...) ||
    !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1 ))
    {
    ...
    }

    When compiled and started toolbar correctly shows large btn images but menu is also enlarged showing 32x32 item images!? How to have menu images as before (small 16x16)? My app info: SDI, VS2008 Thanks in advance!

    M 1 Reply Last reply
    0
    • J josip cagalj

      Hi to all. Is it possible to have a 32x32 images on toolbar while keeping 16x16 in menu. I created toolbar resource (IDR_TOOLBAR1) and set it's button size as 32x32 and load it:

      if (!m_wndToolBar.CreateEx(this,...) ||
      !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1 ))
      {
      ...
      }

      When compiled and started toolbar correctly shows large btn images but menu is also enlarged showing 32x32 item images!? How to have menu images as before (small 16x16)? My app info: SDI, VS2008 Thanks in advance!

      M Offline
      M Offline
      mesajflaviu
      wrote on last edited by
      #2

      See here an project sample which use small and big toolbar in the same application ...

      J 1 Reply Last reply
      0
      • M mesajflaviu

        See here an project sample which use small and big toolbar in the same application ...

        J Offline
        J Offline
        josip cagalj
        wrote on last edited by
        #3

        Thaks for yours replay. The sample you pointed to me unfortunaly uses images only on toolbar and not menu. I've pulled some ideas from it so thanks once again!

        J 1 Reply Last reply
        0
        • J josip cagalj

          Thaks for yours replay. The sample you pointed to me unfortunaly uses images only on toolbar and not menu. I've pulled some ideas from it so thanks once again!

          J Offline
          J Offline
          josip cagalj
          wrote on last edited by
          #4

          I've solved it

          if (!m_wndMenuBar.Create(this))
          {
          TRACE0("Failed to create menubar\n");
          return -1; // fail to create
          }

          m\_wndMenuBar.SetMenuSizes(CSize(22,22), CSize(16,16));
          m\_wndMenuBar.SetPaneStyle(m\_wndMenuBar.GetPaneStyle() | CBRS\_SIZE\_DYNAMIC | CBRS\_TOOLTIPS | CBRS\_FLYBY);
          
          // prevent the menu bar from taking the focus on activation
          CMFCPopupMenu::SetForceMenuFocus(FALSE);
          
          CMFCToolBarInfo tbInfo;
          tbInfo.m\_uiColdResID		= 0;
          tbInfo.m\_uiDisabledResID	= 0;
          tbInfo.m\_uiHotResID		= 0;
          tbInfo.m\_uiLargeColdResID	= 0;
          tbInfo.m\_uiLargeDisabledResID	= 0;
          tbInfo.m\_uiLargeHotResID	= 0;
          tbInfo.m\_uiMenuResID		= IDR\_MAINFRAME\_256;
          
          if (!m\_wndToolBar.CreateEx(this, TBSTYLE\_FLAT, WS\_CHILD | WS\_VISIBLE | CBRS\_TOP | CBRS\_GRIPPER | CBRS\_TOOLTIPS | CBRS\_FLYBY | CBRS\_SIZE\_DYNAMIC) 
          	|| !m\_wndToolBar.LoadToolBarEx(IDR\_TOOLBAR1, tbInfo)) {
          	TRACE0("Failed to create toolbar\\n");
          	return -1;      // fail to create
          }
          

          - Call CMFCMenuBar::SetMenuSizes() before creating toolbar - Use CMFCToolBarInfo struct leaving all members to 0 except m_uiMenuResID where you pass yours 16x16 sized resource entry - CallLoadToolBarEx() Off course IDR_TOOLBAR1 is 32x32 sized

          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