🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problems with Clipping Regions

#1990
From: Chris Marriott
Date: Wed, 16 Dec 1992 22:38
42 lines
1985 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?
>
>Thanks,
>George Frazier frazier@hawk.cs.ukans.edu
>
>

Are you selecting the old clip region before deleting the one you created?
Remember, Windows won't let you delete an object that's currently selected
in a DC.  What you should be doing is:

    ClipRegion = CreateRegion( ..... );
    OldRegion = SelectObject( hDC, ClipRegion );
    .....
    SelectObject( hDC, OldRegion );
    DeleteObject( ClipRegion );

That should work OK.

Chris
-- 
--------------------------------------------------------------------------
| Chris Marriott                           | chris@chrism.demon.co.uk    |
| Warrington, UK                           | BIX: cmarriott              |
| (Still awaiting inspiration              | CIX: cmarriott              |
|  for a witty .sig .... )                 | CompuServe: 100113,1140     |
--------------------------------------------------------------------------
 
Technical Details
Message-ID: <724545535snz@chrism.demon.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
From: chris@chrism.demon.co.uk (Chris Marriott)
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
Subject: Re: Problems with Clipping Regions 
Distribution: world
References: <1992Dec16.152731.45692@kuhub.cc.ukans.edu>
Organization: None
Reply-To: chris@chrism.demon.co.uk
X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
Lines: 42
Date: Wed, 16 Dec 1992 22:38:55 +0000
Message-ID: <724545535snz@chrism.demon.co.uk>
Sender: usenet@demon.co.uk