home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4290 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.8 KB

  1. Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
  2. From: twbrown@PE-Nelson.COM (Tom W. Brown)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Problems with Clipping Regions
  5. Message-ID: <718@lax.lax.pe-nelson.com>
  6. Date: 17 Dec 92 00:34:20 GMT
  7. References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>
  8. Sender: news@lax.pe-nelson.com
  9. Organization: PE-Nelson
  10. Lines: 35
  11.  
  12. In article <1992Dec16.152731.45692@kuhub.cc.ukans.edu>, 2ftptimely@kuhub.cc.ukans.edu writes:
  13. |> I am having a hell of a time with
  14. |> the Windows API call
  15. |> SelectClipRgn(...)
  16. |> 
  17. |> I select a region and clipping works fine but 
  18. |> when I try to unselect the region wDeleteObject(ClipRgn)
  19. |> Then everything else that I paint to
  20. |> that DC is still "clipped". What I want
  21. |> is to restore the DC to how it was before I
  22. |> gave it a new clipping region. This is the
  23. |> DC given to me in the PAINT routine of 
  24. |> Borland OWL in the TWindow class. Any
  25. |> thoughts?
  26.  
  27. When you select a clipping region a copy of the region is placed into the
  28. DC.  Simply using DeleteObject on your region will not affect the copy that
  29. you placed (selected) in the display context.  You need to use SelectClipRgn
  30. with a NULL region handle to remove clipping.
  31.  
  32. If there may have been a different clipping region in effect before you gave
  33. the DC yours then use SaveDC()/RestoreDC() around your code:
  34.  
  35.     SaveDC(hDC);        // push DC on a special GDI stack
  36.     .
  37.     .            // setup new clipping and paint
  38.     .
  39.     RestoreDC(hDC, -1);    // restore DC from top of stack
  40.  
  41.  
  42. ----------------------------------------------------------------------------
  43. Tom Brown               |  "She turned me into a newt...
  44. PE Nelson Systems       |                                  ... I got better"
  45. twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
  46. ----------------------------------------------------------------------------
  47.