Reputation: 194
i have a bool function that checks for points if it is on the ellipse.Also, the user can move his mouse near the ellipse path to select the ellipse in order to move it to a new location. I checked for the corner points of the bounding rectangle of ellipse. If the user selects these four points, the resize feature of ellipse is enabled, Which I have already implemented.
For the move feature to be enabled, I am checking for the point which is at a distance equal to cushion
(i.e. padding provided to the mouse location) using Region class.
In the following code, I have considered 3 bounding rectangles, and if the point to be checked lies between the region of the outside ellipse and inside ellipse,I want to return true.If not,return false.
I want my point to be checked in the region painted in red. p.S::The distance between the consecutive bounding rectangles is same unlike painted in the picture.i.e. Distance between the ellipse edges(outer,middle and inner ) are same Links I referred::Link 1 for the solution
EDIT:: Resolved issue with GraphicsPath.IsOutlineVisible()
Upvotes: 2
Views: 1085
Reputation: 194
I directly used GraphicsPath object to call IsOutlineVisible(point,Pen) to do this.Reference
Upvotes: 1
Reputation: 63317
If you have Region
object in hand, why not use IsVisible
method it supports, like this:
if(yourEllipseRegion.IsVisible(pointToCheck)){
//your code here
}
More info Region.IsVisible
Upvotes: 1