如何将 RectangleF 转换为 PointF[] 进行绘图?
-
29-10-2019 - |
解决方案 2
好的,我在 微软软件定义网络:
destPoints 参数指定平行四边形的三个点。三个 PointF 结构代表 左上, 右上方, , 和 左下角 平行四边形的角。第四点是从前三点推断出来的,形成一个平行四边形。
因此,您可以通过以下方式构建点数组:
private PointF[] GetPoints(RectangleF rectangle)
{
return new PointF[3]
{
new PointF(rectangle.Left, rectangle.Top),
new PointF(rectangle.Right, rectangle.Top),
new PointF(rectangle.Left, rectangle.Bottom)
};
}
其他提示
难道不能只通过构建数组来创建它吗?
(凭记忆)其中 d 是目标 RectangleF:
destPoints[] = new PointF[4] { new PointF(d.Left, d.Top), new PointF(d.Right, d.Top), new PointF(d.Right, d.Bottom), new PointF(d.Left, d.Bottom) };
不隶属于 StackOverflow