Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CProgrammer

MFC CView window scrolling

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Like the title says. How do I add two scrollbars to my MFC app, at the bottom and right of my CView field. I then want to retrieve position data from these scrollbars. Any ideas? Thanks in advance -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
Yeah, there's a couple of ways of doing it:

1. Use CScrollView in place of CView. CScrollView has built-in support for scrolling in a GDI-based application. However, I'm thinking this isn't what you want (I toyed with it for an OpenGL-enabled CView, it didn't work with OpenGL at all), so...

2. You could use the Win32 method, and specify WS_HSCROLL and WS_VSCROLL when the view is created. You'll need to override PreCreateWindow, and modify the style attribute of the CREATESTRUCT that's passed like this: cs.style |= WS_HSCROLL | WS_VSCROLL; Then, set up message handlers to catch WM_HSCROLL and WM_VSCROLL messages. You can set the parameters of the scroll bars by using the Win32 scrollbar functions supported by the CView, namely pView->SetScrollRange, pView->SetScrollPos and pView->SetScrollInfo. Hope this helps...


Windows 95 - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can't stand 1 bit of competition.


[edited by - iNsAn1tY on January 5, 2004 1:11:09 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!