' Classes/System/Drawing/PointF.ab #ifndef __SYSTEM_DRAWING_POINTF_AB__ #define __SYSTEM_DRAWING_POINTF_AB__ #include #include Class PointF Public Sub PointF() x = 0 y = 0 End Sub Sub PointF(initX As Single, initY As Single) x = initX y = initY End Sub Sub PointF(ByRef pt As PointF) x = pt.x y = pt.y End Sub Sub PointF(ByRef sz As SizeF) x = sz.Width y = sz.Height End Sub Function X() As Single Return x End Function Sub X(newX As Single) x = newX End Sub Function Y() As Single Return y End Function Sub Y(newY As Single) y = newY End Sub Function IsEmpty() As BOOL If x = 0 And y = 0 Then Return _System_TRUE Else Return _System_FALSE End If End Function Sub Operator = (ByRef pt As PointF) x = pt.x y = pt.y End Sub Function Operator () As PointF Dim ptf As PointF(X, Y) Return ptf End Function Function Operator + (pt As PointF) As PointF Return Add(This, pt) End Function Function Operator + (sz As Size) As PointF Return Add(This, sz) End Function Function Operator + (sz As SizeF) As PointF Return Add(This, sz) End Function Function Operator - (pt As PointF) As PointF Return Substract(This, pt) End Function Function Operator - (sz As Size) As PointF Return Substract(This, sz) End Function Function Operator - (sz As SizeF) As PointF Return Substract(This, sz) End Function Function Operator == (sz As PointF) As BOOL Return Equals(sz) End Function Function Operator <> (sz As PointF) As BOOL Return Not Equals(sz) End Function Static Function Add(pt1 As PointF, pt2 As PointF) As PointF Dim ret As PointF(pt1.x + pt2.x, pt1.y + pt2.y) Return ret End Function Static Function Add(pt As PointF, sz As Size) As PointF Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height) Return ret End Function Static Function Add(pt As PointF, sz As SizeF) As PointF Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height) Return ret End Function Static Function Substract(pt1 As PointF, pt2 As PointF) As PointF Dim ret As PointF(pt1.x - pt2.x, pt1.y - pt2.y) Return ret End Function Static Function Substract(pt As PointF, sz As Size) As PointF Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height) Return ret End Function Static Function Substract(pt As PointF, sz As SizeF) As PointF Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height) Return ret End Function Function Equals(pt As PointF) As BOOL If x = pt.x And y = pt.y Then Equals = _System_TRUE Else Equals = _System_FALSE End If End Function Private x As Single y As Single End Class #endif '__SYSTEM_DRAWING_POINTF_AB__