home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1664 < prev    next >
Encoding:
Text File  |  1992-09-03  |  1.9 KB  |  57 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!microsoft!wingnut!stevesi
  3. From: stevesi@microsoft.com (Steven Sinofsky)
  4. Subject: Re: Combining Regions in MFC (gripe)
  5. Message-ID: <1992Sep03.220232.4739@microsoft.com>
  6. Date: 03 Sep 92 22:02:32 GMT
  7. Organization: Microsoft Corporation
  8. References: <1831f9INN68k@agate.berkeley.edu>
  9. Distribution: usa
  10. Lines: 43
  11.  
  12. The docs are in error on this one.  Thanks for the report.
  13.  
  14. In article <1831f9INN68k@agate.berkeley.edu> bchen@diva.Berkeley.EDU (Benjamin Chen) writes:
  15. >I was trying to do the following to combine a circular and rectangular
  16. >region:
  17. >
  18. >    CRect bbox;
  19. >    CRgn circle, rect, combine;
  20. >    int status;
  21. >
  22. >    status = circle.CreateEllipticRgnIndirect( bbox );
  23. >    status = rect.CreateRectRgn(top, left, right, bottom);
  24. >    status = combine.CombineRgn(&circle, &rect, RGN_DIFF);
  25. >
  26. >This did not work by itself.  CombineRgn() returned ERROR.
  27. >I needed to add the following statement beforehand:
  28. >
  29. >    status = combine.CreateRectRgn(0, 0, 0, 0);
  30. >
  31. >in order for the CombineRgn() to work, apparently to initialize the
  32. >destination CRgn to some arbitrary dummy region.  This info is nowhere 
  33. >in the MFC docs.  I only tried this after reading the API docs
  34. >(Programmer Reference, Vol 2., p 63) where it states:
  35. >    
  36. >    To use CombineRgn MOST EFFCIENTLY, hrgnDest should be a 
  37. >    trivial region ....
  38. >
  39. >So it probably isn't MFC's "fault".  Still, the note should be reflected
  40. >in the MFC docs.  Also, "MOST EFFICIENTLY" should be deleted from the text 
  41. >since it doesn't work AT ALL if you don't create a trivial region (which
  42. >seems to be a little hacky anyway). Oh, well, just venting some frustration.
  43. >
  44. >    BC
  45. >
  46. >-- 
  47. >Benjamin Chen
  48. >Office:   550-A4 Cory Hall, 2-4332
  49. >UUCP:     !ucbvax!diva!bchen               
  50. >HEPNET:   LBL::"bchen@diva.Berkeley.EDU"
  51.  
  52.  
  53. -- 
  54. Steven Sinofsky
  55. stevesi@microsoft.com
  56. Disclaimer: I don't speak for Microsoft, BillG does that.
  57.