How do you use MFC CScrollbar controls?

2019-05-04 23:29发布

问题:

I have dropped a horizontal CScrollBar control onto a dialog box. How on earth do you use it??

I tried moving the grip to the right and it jumped straight back to the left.. so I figured I may need to set the range. I called SetScrollRange( 0, 100 ) and it still does the same thing. I can't find any examples on Google that help - all scrollbar references seem to refer to using the view class etc etc but thats not what I want to do.

All I want to do is move the grip and get a notification message back of some description, how do I do that (please)?

回答1:

For anybody that wants to know, you need to handle the WM_HSCROLL/WM_VSCROLL messages yourself.. and call SetScrollPos() yourself when receiving the SB_THUMBPOSITION messages.



标签: mfc scrollbar