I'm using Windows visual studio 2015 winforms to draw rectangles on a panel. I get my information from a list of objects(bricks). I just check the rotation for each brick:
My brick holds the following information:
string ID;
PointF MiddlePoint;
float Length;
float Height;
float Rotation;
Creating the rectangle with a 90/270 angle of degree.
if (a_BrickList[i].Rotation == 90 || a_BrickList[i].Rotation == 270)
{
UpperLeftPoint.X = Xorigin + (a_BrickList[i].MiddlePoint.X - (a_BrickList[i].Length / 2) + panelOffset) * scale;
UpperLeftPoint.Y = Yorigin - (a_BrickList[i].MiddlePoint.Y + (a_BrickList[i].Height / 2) + panelOffset) * scale;
rect = new RectangleF(UpperLeftPoint.X, UpperLeftPoint.Y, Length, Height);
GlueRectangles[i] = rect;
}
I've added another if statement:
if (a_BrickList[i].Rotation != 0 && a_BrickList[i].Rotation != 180 &&
a_BrickList[i].Rotation != 90 && a_BrickList[i].Rotation != 270)
In this one I want to draw a rectangle on a certain angle of degree. But I can't really find anything about the rectangle
with rotate
or angle
.
So is there a way to draw a rectangle with a certain angle of degree?
Or can I only solve this by calculating the 4 points of my rectangle and draw lines between them?