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. Sizing Toolbar buttons (Win32)

Sizing Toolbar buttons (Win32)

Scheduled Pinned Locked Moved C / C++ / MFC
csharphelptutorialquestion
2 Posts 1 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.
  • W Offline
    W Offline
    Ward 0
    wrote on last edited by
    #1

    Hi, My problem is that I can't make the size of the toolbar buttons right. This is my code: HWND CreateMyToolbar(HWND hWnd) { HWND hToolbar; hToolbar = NULL; hToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,"MyToolbar",WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS ,0,0,0,0,hWnd,0,g_hInstance,NULL); if(hToolbar) { SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); TBBUTTON tbb[1]; TBADDBITMAP tbab; tbab.hInst = HINST_COMMCTRL; tbab.nID = IDB_STD_LARGE_COLOR; SendMessage(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab); ZeroMemory(tbb, sizeof(tbb)); tbb[0].iBitmap = STD_FILENEW; tbb[0].fsState = TBSTATE_ENABLED; tbb[0].fsStyle = TBSTYLE_BUTTON; tbb[0].idCommand = IDM_FILENEW; SendMessage(hToolbar, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb); return hToolbar; } return NULL; } I've set the IDB_STD_LARGE_COLOR imagelist, but in the result the button image is clipped on the bottom. Can someone show me how to do this right? thanks in advance, Ward

    W 1 Reply Last reply
    0
    • W Ward 0

      Hi, My problem is that I can't make the size of the toolbar buttons right. This is my code: HWND CreateMyToolbar(HWND hWnd) { HWND hToolbar; hToolbar = NULL; hToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,"MyToolbar",WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS ,0,0,0,0,hWnd,0,g_hInstance,NULL); if(hToolbar) { SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); TBBUTTON tbb[1]; TBADDBITMAP tbab; tbab.hInst = HINST_COMMCTRL; tbab.nID = IDB_STD_LARGE_COLOR; SendMessage(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab); ZeroMemory(tbb, sizeof(tbb)); tbb[0].iBitmap = STD_FILENEW; tbb[0].fsState = TBSTATE_ENABLED; tbb[0].fsStyle = TBSTYLE_BUTTON; tbb[0].idCommand = IDM_FILENEW; SendMessage(hToolbar, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb); return hToolbar; } return NULL; } I've set the IDB_STD_LARGE_COLOR imagelist, but in the result the button image is clipped on the bottom. Can someone show me how to do this right? thanks in advance, Ward

      W Offline
      W Offline
      Ward 0
      wrote on last edited by
      #2

      Ok, I figured it out by myself. Finally. Ward

      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