home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3532 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.1 KB

  1. Path: 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
  2. From: dpn2@po.CWRU.Edu (Damien P. Neil)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: How do you scroll (part of a) window??
  5. Date: Wed, 18 Nov 1992 23:42:16 GMT
  6. Organization: Case Western Reserve University
  7. Lines: 28
  8. Message-ID: <dpn2.110.722130136@po.CWRU.Edu>
  9. References: <1992Nov18.204742.9936@leland.Stanford.EDU>
  10. NNTP-Posting-Host: b63519.student.cwru.edu
  11.  
  12. In article <1992Nov18.204742.9936@leland.Stanford.EDU> rlswent@leland.Stanford.EDU (Richard Swent) writes:
  13. >I can't figure out how to implement scrolling in a sensible
  14. >manner. I want to have a window that has some header information
  15. >and some buttons at the top, then a long list below that can
  16. >be scrolled via a scroll bar. The part of the window that scrolls
  17. >can be a child window if that is easier. 
  18. >
  19. >I've looked at the scrolling functions (ScrollWindow, ScrollDC) and
  20. >can't make them work right. If I use ScrollWindow it scrolls the
  21. >bitmap but as soon as my Paint procedure is called, it paints stuff
  22. >just the way it had been. I tried ScrollDC and it didn't do anything
  23. >at all. The problem is really my Paint procedure which doesn't know
  24. >anything about the scrolling. What is the "right" way to do this?
  25.  
  26. OK, you have the right idea here. ScrollWindow will work just fine for 
  27. scrolling the window -- what you have to do is make your Paint procedure 
  28. scroll aware. In other words, if you scroll the window 10 pixels left, you 
  29. must have your Paint procedure draw everything offset by 10 pixels.
  30.  
  31. This is a pain to do, but not really that difficult once you get it going. 
  32. Just keep a "xoffset" and "yoffset" pair of variables, and use them in all 
  33. your GDI calls.
  34.  
  35. Alternatively, buy/write a good class library and get it to do it for 
  36. you... :-)
  37. +-------------+------------------+---------------------------------+
  38. | Damien Neil | dpn2@po.cwru.edu | Case Western Reserve University |
  39. +-------------+------------------+---------------------------------+
  40.