home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!microsoft!wingnut!stevesi
- From: stevesi@microsoft.com (Steven Sinofsky)
- Subject: Re: Combining Regions in MFC (gripe)
- Message-ID: <1992Sep03.220232.4739@microsoft.com>
- Date: 03 Sep 92 22:02:32 GMT
- Organization: Microsoft Corporation
- References: <1831f9INN68k@agate.berkeley.edu>
- Distribution: usa
- Lines: 43
-
- The docs are in error on this one. Thanks for the report.
-
- In article <1831f9INN68k@agate.berkeley.edu> bchen@diva.Berkeley.EDU (Benjamin Chen) writes:
- >I was trying to do the following to combine a circular and rectangular
- >region:
- >
- > CRect bbox;
- > CRgn circle, rect, combine;
- > int status;
- >
- > status = circle.CreateEllipticRgnIndirect( bbox );
- > status = rect.CreateRectRgn(top, left, right, bottom);
- > status = combine.CombineRgn(&circle, &rect, RGN_DIFF);
- >
- >This did not work by itself. CombineRgn() returned ERROR.
- >I needed to add the following statement beforehand:
- >
- > status = combine.CreateRectRgn(0, 0, 0, 0);
- >
- >in order for the CombineRgn() to work, apparently to initialize the
- >destination CRgn to some arbitrary dummy region. This info is nowhere
- >in the MFC docs. I only tried this after reading the API docs
- >(Programmer Reference, Vol 2., p 63) where it states:
- >
- > To use CombineRgn MOST EFFCIENTLY, hrgnDest should be a
- > trivial region ....
- >
- >So it probably isn't MFC's "fault". Still, the note should be reflected
- >in the MFC docs. Also, "MOST EFFICIENTLY" should be deleted from the text
- >since it doesn't work AT ALL if you don't create a trivial region (which
- >seems to be a little hacky anyway). Oh, well, just venting some frustration.
- >
- > BC
- >
- >--
- >Benjamin Chen
- >Office: 550-A4 Cory Hall, 2-4332
- >UUCP: !ucbvax!diva!bchen
- >HEPNET: LBL::"bchen@diva.Berkeley.EDU"
-
-
- --
- Steven Sinofsky
- stevesi@microsoft.com
- Disclaimer: I don't speak for Microsoft, BillG does that.
-