Die folgende Methode ermittelt die 4 Eckpunkte eines Rectangles und gibt diese in einem Array zurück.
Die Reihnfolge ist:
0: TopLeft
1: TopRight
2: BottomLeft
3: BottomRight
private Point[] GetBoundPoints(Rectangle bounds)
{
Point TopLeft = bounds.Location;
Point TopRight = bounds.Location;
Point BottomLeft = bounds.Location;
Point BottomRight = bounds.Location;
TopRight.Offset(bounds.Width, 0);
BottomLeft.Offset(0, bounds.Height);
BottomRight.Offset(bounds.Width, bounds.Height);
return new Point[] { TopLeft, TopRight, BottomLeft, BottomRight };
}
Kommentare zum Snippet