473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to find point in region


Hello,
I have drawn polygon on window. And I want to check wheather given
point is in that polygon region or not? How shold I find that? I have
created object of class region

GraphicsPath path = new GraphicsPath();
path.AddPolygon(pts); //////// Some points I have passed
Region rgn = new Region(path);
RegionData rgnDta = rgn.GetRegionData();

Now I have to check Wheather any point That I will give is in that
Region or not?

Please send me solution of this problem.
Thanks in advance.

Jan 9 '07 #1
1 8386
Hi Renu,

All you need to do is use the GraphicsPath to do the HitTesting
this will do what you want.

public bool HitTest(Point p)
{
if(path.IsVisible(p))
return(true);
else
return(false);
}

Mike Powell
www.ramuseco.com

"renu" <re*************@gmail.comwrote in message
news:11**********************@51g2000cwl.googlegro ups.com...
>
Hello,
I have drawn polygon on window. And I want to check wheather given
point is in that polygon region or not? How shold I find that? I have
created object of class region

GraphicsPath path = new GraphicsPath();
path.AddPolygon(pts); //////// Some points I have passed
Region rgn = new Region(path);
RegionData rgnDta = rgn.GetRegionData();

Now I have to check Wheather any point That I will give is in that
Region or not?

Please send me solution of this problem.
Thanks in advance.

Jan 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Basquille | last post by:
Hello all, Quick question! How would i keep a point inside a region? For example, the mouse pointer. You should be able to move the mouse around in this region but not anywhere outside it. ...
4
by: vbMark | last post by:
Greetings, (Using C# express 2005 beta) Is there any tool or script that will wrap a procedure in a #region and put the name of the procedure in the region name? Thanks! --
0
by: JR | last post by:
Hi, i found a user control on the net see code below it is part of VSEssential but I like the coolProgressBar. Zo I want to use it into my program and I always get the error that it can't find...
4
by: Don | last post by:
When creating a new region for a control via a GraphicsPath object, it appears the entire rightmost column of pixels and bottom most row of pixels are not included in the region. I will try to...
3
by: Peter Proost | last post by:
Hi group, I've got this bit of code (see below) which draws a basketball field in a picturebox (width:198, height:368) but now I was wondering what would be the easiest way to check inside the...
0
by: rlg | last post by:
Is there a staightforward way of improving the performance of FillRegion when drawing a very small window on a very large region? The C# example below illustrates the issue - it takes about 5...
3
by: illusion.admins | last post by:
I am trying to code something to tell me if a selected point is in a particular ellipse. For the ellipse I know how it was constructed (know the x,y, and width, height). But if I just check to see...
3
by: Grant Edwards | last post by:
I've recently switched from Jed to Emacs for editing python source, and I'm still stumped as to how one indents or dedents a region of code. In Jed it's 'C-c <' or 'C-c >'. Google has found...
3
by: raylopez99 | last post by:
I suspect the answer to this question is that it's impossible, but how do I make the below code work, at the point where it breaks (marked below). See error CS0411 This is the complete code. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.