Article View: comp.os.ms-windows.programmer.misc
Article #2131Re: How do you scroll (part of a) window??
From: Damien P. Neil
Date: Wed, 18 Nov 1992 23:42
Date: Wed, 18 Nov 1992 23:42
28 lines
2141 bytes
2141 bytes
In article <1992Nov18.204742.9936@leland.Stanford.EDU> rlswent@leland.Stanford.EDU (Richard Swent) writes: >I can't figure out how to implement scrolling in a sensible >manner. I want to have a window that has some header information >and some buttons at the top, then a long list below that can >be scrolled via a scroll bar. The part of the window that scrolls >can be a child window if that is easier. > >I've looked at the scrolling functions (ScrollWindow, ScrollDC) and >can't make them work right. If I use ScrollWindow it scrolls the >bitmap but as soon as my Paint procedure is called, it paints stuff >just the way it had been. I tried ScrollDC and it didn't do anything >at all. The problem is really my Paint procedure which doesn't know >anything about the scrolling. What is the "right" way to do this? OK, you have the right idea here. ScrollWindow will work just fine for scrolling the window -- what you have to do is make your Paint procedure scroll aware. In other words, if you scroll the window 10 pixels left, you must have your Paint procedure draw everything offset by 10 pixels. This is a pain to do, but not really that difficult once you get it going. Just keep a "xoffset" and "yoffset" pair of variables, and use them in all your GDI calls. Alternatively, buy/write a good class library and get it to do it for you... :-) +-------------+------------------+---------------------------------+ | Damien Neil | dpn2@po.cwru.edu | Case Western Reserve University | +-------------+------------------+---------------------------------+
Technical Details
Message-ID:
<dpn2.110.722130136@po.CWRU.Edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!b63519.STUDENT.CWRU.Edu!dpn2References:
<1992Nov18.204742.9936@leland.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!b63519.STUDENT.CWRU.Edu!dpn2 From: dpn2@po.CWRU.Edu (Damien P. Neil) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: How do you scroll (part of a) window?? Date: Wed, 18 Nov 1992 23:42:16 GMT Organization: Case Western Reserve University Lines: 28 Message-ID: <dpn2.110.722130136@po.CWRU.Edu> References: <1992Nov18.204742.9936@leland.Stanford.EDU> NNTP-Posting-Host: b63519.student.cwru.edu