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. Scrollbar in CFormView does not work,why?

Scrollbar in CFormView does not work,why?

Scheduled Pinned Locked Moved C / C++ / MFC
c++comdesignquestionlearning
2 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.
  • L Offline
    L Offline
    lostangels
    wrote on last edited by
    #1

    just crreating a new SDI project with VC++ wizard, choose CFormView as the base view class, then switch to the resource editor, place a CListBox control on the formview, and make sure to enlarge the formview design size so that a scrollbar can appear later, then ,build it and run, though the scrollbar is visible, but i just can't let it scroll with my middle mouse wheel, can anybody tell me what's the reason?? thanks a lot. lostangels@163.com

    O 1 Reply Last reply
    0
    • L lostangels

      just crreating a new SDI project with VC++ wizard, choose CFormView as the base view class, then switch to the resource editor, place a CListBox control on the formview, and make sure to enlarge the formview design size so that a scrollbar can appear later, then ,build it and run, though the scrollbar is visible, but i just can't let it scroll with my middle mouse wheel, can anybody tell me what's the reason?? thanks a lot. lostangels@163.com

      O Offline
      O Offline
      Optimus Chaos
      wrote on last edited by
      #2

      To perform mousewhel scrolling in a CFormView you have to enter the logic yourself. You have to respond to WM_MOUSEWHELL. Here's a snippet that worked for me: BOOL CSomeFormView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { // test if it is visible first if ( GetStyle() & WS_VSCROLL ) { CPoint ptScroll = GetScrollPosition(); // determine the amount of scrolling int nLines = -zDelta / WHEEL_DELTA; // Scroll to new position ScrollToPosition ( ptScroll + CPoint ( 0, nLines * 15 ) ); } return CFormView::OnMouseWheel(nFlags, zDelta, pt); }

      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