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. scrollbars

scrollbars

Scheduled Pinned Locked Moved C / C++ / MFC
wpfcomtutorialannouncement
1 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.
  • A Offline
    A Offline
    Adno
    wrote on last edited by
    #1

    creating scrollbar.... case WM_CREATE: sb1 = CreateWindowEx( 0L, // no extended styles "SCROLLBAR", // scroll bar control class (LPSTR) NULL, // text for window title bar WS_CHILD | SBS_HORZ | WS_VISIBLE, // scroll bar styles 50, // horizontal position 20, // vertical position 200, // width of the scroll bar 100, // default height hwnd, // handle to main window (HMENU) NULL, // no menu for a scroll bar hInst, // instance owning this window (LPVOID) NULL // pointer not needed ); ............. and then in the message loop: //------------------------------------------------- case WM_HSCROLL:{ int xNewPos; // new position switch (LOWORD(wParam)) { // User clicked the shaft left of the scroll box. case SB_PAGEUP: xNewPos = xCurrentScroll - 50; break; // User clicked the shaft right of the scroll box. case SB_PAGEDOWN: xNewPos = xCurrentScroll + 50; break; // User clicked the left arrow. case SB_LINEUP: xNewPos = xCurrentScroll - 5; break; // User clicked the right arrow. case SB_LINEDOWN: xNewPos = xCurrentScroll + 5; break; // User dragged the scroll box. case SB_THUMBPOSITION: xNewPos = HIWORD(wParam); break; default: xNewPos = xCurrentScroll; }; if (xNewPos == xCurrentScroll) break; xCurrentScroll = xNewPos; si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS ; si.nMax = 300; si.nMin = 0; si.nPage = 4; si.nPos = xCurrentScroll; SetScrollInfo(sb1, SB_HORZ, &si, true); InvalidateRect( hwnd, NULL, TRUE ); } //-------------------------------------- the new one shows over the old one. i.e the scrollbar with the height of 100 which i set up shows over the one with the default height, and dont update. The old one does update when i press the on the new. visual example, from the code above this happens. http://i3.photobucket.com/albums/y98/lamefif/scrollbar.jpg[^] many thanks

    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