gpt4 book ai didi

c# - 以 PointF 为圆心绘制圆 c#

转载 作者:太空宇宙 更新时间:2023-11-03 20:34:44 25 4
gpt4 key购买 nike

我一直在寻找这个,但找不到任何东西。我的想法是我有一个类似 (52.66, 60.11) 的 PointF,我想以此 PointF 为中心绘制一个空圆。我试图用 DrawEllipse 做,但它不关心中心!它只是一个矩形...我认为应该使用某种转换公式?

最佳答案

您可以根据中心和半径计算矩形的坐标:

float x = center.X - radius;
float y = center.Y - radius;
float width = 2 * radius;
float height = 2 * radius;
graphics.DrawEllipse(pen, x, y, width, height);

关于c# - 以 PointF 为圆心绘制圆 c#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5549537/

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