This commit is contained in:
2019-09-30 16:18:53 +02:00
parent 7d884d7cba
commit 53f2a0666b
70 changed files with 2984 additions and 197 deletions

View File

@@ -1,9 +1,9 @@
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class HelpfulDrawingFunctions
Public Module HelpfulDrawingFunctions
Public Shared Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean
Public Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean
Dim bList As New List(Of Boolean)
bList.Add(p.X > rect.Left)
@@ -14,11 +14,20 @@ Public Class HelpfulDrawingFunctions
Return Not bList.Contains(False)
End Function
Public Shared Function OverlapsTwoRectangles(a As RectangleF, b As RectangleF) As Boolean
Public Function OverlapsTwoRectangles(a As RectangleF, b As RectangleF) As Boolean
Return a.IntersectsWith(b) 'RectangleF.Intersect(a, b) <> RectangleF.Empty
End Function
Public Shared Function GetRectangle(p1 As PointF, p2 As PointF) As RectangleF
Public Function RectangleContainsRectangle(parent As RectangleF, child As RectangleF) As Boolean
Return parent.Contains(child)
'Return _
' IsPointInRectangle(New PointF(child.Top, child.Left), parent) AndAlso
' IsPointInRectangle(New PointF(child.Top, child.Right), parent) AndAlso
' IsPointInRectangle(New PointF(child.Bottom, child.Left), parent) AndAlso
' IsPointInRectangle(New PointF(child.Bottom, child.Right), parent)
End Function
Public Function GetRectangle(p1 As PointF, p2 As PointF) As RectangleF
Dim rect As New RectangleF
Dim startIsEnd As Boolean = p1.X > p2.X AndAlso p1.Y > p2.Y
@@ -37,5 +46,5 @@ Public Class HelpfulDrawingFunctions
Return rect
End Function
End Class
End Module