Region visible in another Region?

  • Thread starter Thread starter Brian Basquille
  • Start date Start date
B

Brian Basquille

Another question for ye all..

How do i check if a Region has entered another region?

Up until now, i've been checking if rectangles (or images converted into
Rectangles) have been visible in a Region (Region.IsVisible) but all
parameters in IsVisible seem to be for Rectangles / points.

To check if a Region is in another Region, i'd probably have to use the
Region.Intersect.. am i on the right track?

Many thanks in advance.

Brian
 
First of all check the region bounds and then, if they overlap, intersect
the two regions and see if the result is empty or not.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Cheers Bob.

I presumed you would have to use Region.Intersect.

However, this is the one area in Region that i have the problem... have
tried using Region.Intersect but how do i work with it if it has a void
return type?

This is my problem:

The two regions i have are rgnPaddle1 and rgnPuck.

I need to check for an intersection between the two regions so i presume
something like:
intersection = rgnPaddle1.Intersect(rgnPuck)

if(intersection!= null)
puckHit = true;

if(puckHit == true)
{
// carry out actions (puck has been hit)
}

But like i said.. Region.Intersect() has void return type.

Any more suggestions on how to implement this?

Thanks again Bob.

Brian
 
Back
Top