home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
- From: twbrown@PE-Nelson.COM (Tom W. Brown)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: Problems with Clipping Regions
- Message-ID: <718@lax.lax.pe-nelson.com>
- Date: 17 Dec 92 00:34:20 GMT
- References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>
- Sender: news@lax.pe-nelson.com
- Organization: PE-Nelson
- Lines: 35
-
- In article <1992Dec16.152731.45692@kuhub.cc.ukans.edu>, 2ftptimely@kuhub.cc.ukans.edu writes:
- |> I am having a hell of a time with
- |> the Windows API call
- |> SelectClipRgn(...)
- |>
- |> I select a region and clipping works fine but
- |> when I try to unselect the region wDeleteObject(ClipRgn)
- |> Then everything else that I paint to
- |> that DC is still "clipped". What I want
- |> is to restore the DC to how it was before I
- |> gave it a new clipping region. This is the
- |> DC given to me in the PAINT routine of
- |> Borland OWL in the TWindow class. Any
- |> thoughts?
-
- When you select a clipping region a copy of the region is placed into the
- DC. Simply using DeleteObject on your region will not affect the copy that
- you placed (selected) in the display context. You need to use SelectClipRgn
- with a NULL region handle to remove clipping.
-
- If there may have been a different clipping region in effect before you gave
- the DC yours then use SaveDC()/RestoreDC() around your code:
-
- SaveDC(hDC); // push DC on a special GDI stack
- .
- . // setup new clipping and paint
- .
- RestoreDC(hDC, -1); // restore DC from top of stack
-
-
- ----------------------------------------------------------------------------
- Tom Brown | "She turned me into a newt...
- PE Nelson Systems | ... I got better"
- twbrown@pe-nelson.com | Monty Python and the Holy Grail
- ----------------------------------------------------------------------------
-