What does it even mean for a Point to be greater than or less than another Point? The Point structure doesn't implement IComparable for a reason. There is no standard meaning to a Point being "within a range" but I can think of two meanings that could be used in specific scenarios. It might mean for a Point to be on the line between two other Points or it might mean for a Point to be within the rectangle described by the other two Points. I'm guessing that you mean the latter. If so, I'd probably write the following extension method:
vb.net Code:
Imports System.Runtime.CompilerServices
Public Module PointExtensions
<Extension>
Public Function IsInRange(source As Point, start As Point, [end] As Point) As Boolean
Dim box As New Rectangle(Math.Min(start.X, [end].X),
Math.Min(start.Y, [end].Y),
Math.Abs(start.X - [end].X),
Math.Abs(start.Y - [end].Y))
Return box.Contains(source)
End Function
End Module
You can then do this:
vb.net Code:
Dim p1 As New Point(1, 4)
Dim p2 As New Point(0, 3)
Dim p3 As New Point(8, 10)
If p1.IsInRange(p2, p3) Then
'...
End If
If "within a range" means something different to you, you just change the implementation of the IsInRange method.