【问题标题】:It is possible to use Graphic class and draw something in for?可以使用 Graphic 类并在其中绘制一些东西吗?
【发布时间】:2022-06-10 19:09:39
【问题描述】:

我想使用函数 drawEllipse 或 fillEllipse 到 for(int a=0; a > 7; a++{ **code here** } 但是当我这样做时没有显示

public static void FillCircle(this Graphics g, Brush brush, float centerX, float centerY, float radius)
{
    g.FillEllipse(brush, centerX - radius, centerY - radius, radius + radius, radius + radius);
}

private void dashboard_Paint(object sender, PaintEventArgs e)
{
    int offset = 0;
    for (int i = 0; i > 7; i++)
    {
        using (Brush b = new SolidBrush(ColorTranslator.FromHtml("#2A2A2A")))
        {
            DrawUtils.FillCircle(e.Graphics, b, 30 + offset, 30, 6);
        }
        offset = offset + 5;
    }
}

【问题讨论】:

  • 是的,这行得通。

标签: c#


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-26
相关资源
最近更新 更多