Coder's Guild Mailing List

Re: Region problems

Posted by Hal Bonnin on 2001-04-11

you dont want to point to the original.. you need to create a copy of the
original. since im not sure what language you are useing so i will use fake
code...

Rgn1=createellipticrgn(0,0,200,200);
Rgn2=createellipticrgn(GetX(Rgn1),GetY(Rgn1),GetWidth(Rgn1),GetHeight(Rgn1))
;
offsetrgn(Rgn2,20,20);

hope this helps.......  not sure if you ca access the Rgn1 data using
Rgn1->X; or Rgn1.X

----- Original Message -----
From: "Alisdair Owens" <AlisdairO@xxx.xxx>
To: <triangle@xxxxxxx.xxx>
Sent: Wednesday, April 11, 2001 1:03 PM
Subject: Region problems


> I am working with windows regions to define graphical boundaries.  I want
to
> copy the data of one region to another.  The code I have at the moment
goes
> something like this:
>
> Procedure.......
> Var
> Rgn1, Rgn2:HRGN;
> begin
> Rgn1 := createellipticrgn(0,0,200,200);
> Rgn2 := Rgn1;
> offsetrgn(Rgn2,20,20);
>
> This should result in two elliptical regions, one offset by (20,20) from
the
> other.  Unfortunately, modifying Rgn2 results in modifying Rgn1, which I
want to
> stay constant.  I believe this is because the HRGN type just to the region
data,
> so both Rgn1 and Rgn2 point to the same data when I use Rgn2 := Rgn1.  How
can I
> make Rgn2 point to a separate copy of the same data? (I am using Delphi,
> although this shouldn't matter much as I am working with the Windows API)
>
> Many thanks
>
> Alisdair Owens
>
> > 
>