rbulph Posted November 2, 2006 Posted November 2, 2006 Does the GraphicsPath have any method for determining whether a given point is within a certain distance of any point on the path? This would seem quite a natural facility for it to provide, but I can't see it anywhere. In its absence it looks as if I will have to call the Flatten method and then test for each pair of points as if they were a short line. Quote
rbulph Posted November 2, 2006 Author Posted November 2, 2006 Easy: Public Class Form1 Dim gp As Drawing2D.GraphicsPath Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint gp = New Drawing2D.GraphicsPath gp.AddArc(New Rectangle(50, 50, 200, 200), 0, 145) gp.AddLine(gp.GetLastPoint, New Point(100, 100)) e.Graphics.DrawPath(Pens.Blue, gp) End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove Dim hp As New Pen(Color.Black, 6) 'Thickness of hypothetical pen is subjective, but 6 seems about right. If gp.IsOutlineVisible(e.Location, hp) Then Me.Cursor = Cursors.Cross Else Me.Cursor = Cursors.Default End If End Sub End Class Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.