🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1967

Re: Problems with Clipping Regions

#1967
From: Tom W. Brown
Date: Thu, 17 Dec 1992 00:34
35 lines
1910 bytes
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
----------------------------------------------------------------------------
Technical Details
Message-ID: <718@lax.lax.pe-nelson.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown
References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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