home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4314 < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.9 KB  |  57 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. From: chris@chrism.demon.co.uk (Chris Marriott)
  3. Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
  4. Subject: Re: Problems with Clipping Regions 
  5. Distribution: world
  6. References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>
  7. Organization: None
  8. Reply-To: chris@chrism.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 42
  11. Date: Wed, 16 Dec 1992 22:38:55 +0000
  12. Message-ID: <724545535snz@chrism.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <1992Dec16.152731.45692@kuhub.cc.ukans.edu> 2ftptimely@kuhub.cc.ukans.edu writes:
  16.  
  17. >I am having a hell of a time with
  18. >the Windows API call
  19. >SelectClipRgn(...)
  20. >
  21. >I select a region and clipping works fine but 
  22. >when I try to unselect the region wDeleteObject(ClipRgn)
  23. >Then everything else that I paint to
  24. >that DC is still "clipped". What I want
  25. >is to restore the DC to how it was before I
  26. >gave it a new clipping region. This is the
  27. >DC given to me in the PAINT routine of 
  28. >Borland OWL in the TWindow class. Any
  29. >thoughts?
  30. >
  31. >Thanks,
  32. >George Frazier frazier@hawk.cs.ukans.edu
  33. >
  34. >
  35.  
  36. Are you selecting the old clip region before deleting the one you created?
  37. Remember, Windows won't let you delete an object that's currently selected
  38. in a DC.  What you should be doing is:
  39.  
  40.     ClipRegion = CreateRegion( ..... );
  41.     OldRegion = SelectObject( hDC, ClipRegion );
  42.     .....
  43.     SelectObject( hDC, OldRegion );
  44.     DeleteObject( ClipRegion );
  45.  
  46. That should work OK.
  47.  
  48. Chris
  49. -- 
  50. --------------------------------------------------------------------------
  51. | Chris Marriott                           | chris@chrism.demon.co.uk    |
  52. | Warrington, UK                           | BIX: cmarriott              |
  53. | (Still awaiting inspiration              | CIX: cmarriott              |
  54. |  for a witty .sig .... )                 | CompuServe: 100113,1140     |
  55. --------------------------------------------------------------------------
  56.  
  57.