Looking for something like:
dim rect as system.drawing.rectangle
For each point in rect Debug.print(point.name, point.value) Next
Looking for something like:
dim rect as system.drawing.rectangle
For each point in rect Debug.print(point.name, point.value) Next
you could write an extension method that returns you an array of the points you want. I don't really do VB, but an example in C# would be something like...
public static class RectangleExtensions
{
public static Point[] GetPoints(this Rectangle rect)
{
return new Point[]
{
new Point(rect.Left, rect.Top),
new Point(rect.Right, rect.Top),
new Point(rect.Right, rect.Bottom),
new Point(rect.Left, rect.Bottom)
};
}
}
public class example
{
public void ExampleMethod()
{
Rectangle rect = new Rectangle();
foreach (Point point in rect.GetPoints())
Console.WriteLine(point.ToString());
}
}
Function GetAllPoints(ByVal r As Rectangle) As Point()
Return { _
New Point(r.Left, r.Top), _
New Point(r.Right, r.Top), _
New Point(r.Left, r.Bottom), _
New Point(r.Right, r.Bottom) _
}
End Function
(Line continuation added to support older versions of VB.NET)