Windows Visual Studio 2015 winforms を使用して、パネルに四角形を描画しています。オブジェクト (レンガ) のリストから情報を取得します。各レンガの回転を確認するだけです。
私のブリックには次の情報が含まれています。
string ID;
PointF MiddlePoint;
float Length;
float Height;
float Rotation;
角度が 90/270 の長方形を作成します。
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;
}
別の if ステートメントを追加しました。
if (a_BrickList[i].Rotation != 0 && a_BrickList[i].Rotation != 180 &&
a_BrickList[i].Rotation != 90 && a_BrickList[i].Rotation != 270)
これでは、特定の角度で長方形を描きたいと思います。rectangle
しかし、 withrotate
またはについては本当に何も見つかりませんangle
。
では、特定の角度の長方形を描く方法はありますか?
または、長方形の 4 つの点を計算し、それらの間に線を引くことによってのみ、これを解決できますか?