问题描述
现在我想让圆沿着多边形的边。有人可以帮我吗?
代码
namespace polygon
{
public partial class Form1 : Form
{
int x,y;
Pen p1 = new Pen(Color.DarkBlue,5);
PointF[] puncte = new PointF[4];
public Form1()
{
InitializeComponent();
x = 100;
y = 100;
}
private void Form1_Paint(object sender,PaintEventArgs e)
{
puncte[0] = new PointF(100,100);
puncte[1] = new PointF(320,100);
puncte[2] = new PointF(380,320);
puncte[3] = new PointF(100,320);
e.Graphics.DrawPolygon(p1,puncte);
e.Graphics.FillEllipse(Brushes.Red,x,y,40,40);
}
public void timer1_Tick(object sender,EventArgs e)
{
if (x < 300 && y == 80)
x = x + 20;
else
if (y < 300 && x == 300)
y = y + 20;
else
if (y == 300 && x > 80)
x = x - 20;
else
y = y - 20;
Invalidate();
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)