帮我,过程步骤么么么么么么么密密麻麻密密麻麻密密麻麻密密麻麻密密麻麻密密麻麻密密麻麻么么么么么么么
简单的对角线往复运动。
添加个form,form里添加1个timer。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int width = 100, height = 100;
private int x = 0, dx = 10;
Graphics g;
private void draw(Graphics g)
{
g.Clear(this.BackColor);
Brush bush = new SolidBrush(Color.Green);
g.FillEllipse(bush,new Rectangle(x, x, width, height));
x += dx;
if (dx>0 && (x >= this.Width - width || x>=this.Height-height))
{
dx = -dx;
}
else if (dx < 0 && x <= 0)
dx = -dx;
}
private void Form1_Load(object sender, EventArgs e)
{
this.Size = new Size(600, 600);
this.DoubleBuffered = true;
timer1.Interval = 10;
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
g = this.CreateGraphics();
}
private void timer1_Tick(object sender, EventArgs e)
{
draw(g);
}
}
参考这个https://ask.csdn.net/questions/7462443,先画一个圆,然后擦掉这个圆,然后修改圆心坐标从新画个圆,圆心位置,就用公式套出来就可以,线性方程,自己写吧
你俩可以交流沟通一下,说不定能碰撞出什么思路,https://ask.csdn.net/questions/7465493?spm=1005.2025.3001.5141