home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1650 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.7 KB

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