gpt4 book ai didi

c# - 如何将 RectangleF 转换为 PointF[] 进行绘图?

转载 作者:行者123 更新时间:2023-11-30 22:31:06 26 4
gpt4 key购买 nike

我不确定这个问题是否太琐碎了,但是我需要使用 following方法 Graphics.DrawImage 的重载:

public void DrawImage(
Image image,
PointF[] destPoints,
RectangleF srcRect,
GraphicsUnit srcUnit,
ImageAttributes imageAttr
)

我有一个 RectangleF 作为目标矩形,所以我需要将 RectangleF 转换为 PointF[]example in the MSDN我有点困惑,因为它只使用三个点来定义平行四边形。

我该怎么做?

提前致谢

最佳答案

不可以只构造数组来创建吗?

(凭内存)其中 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) };

关于c# - 如何将 RectangleF 转换为 PointF[] 进行绘图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9402224/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com