然后在button3中设置往返
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
label1.Location = new Point(label1.Location.X + 10, label1.Location.Y);
}
private void button2_Click(object sender, EventArgs e)
{
int i = 0;
for (i = 0; i < 500; i++)
label1.Location = new Point(label1.Location.X + 5, label1.Location.Y);
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
label1.Location = new Point(0, 0);
}
}
}