using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.pictureBox1.Left -=3;
if (this.pictureBox1.Right < 0)
{
this.pictureBox1.Left = this.Width;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
this.timer2.Start();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer2_Tick(object sender, EventArgs e)
{
this.pictureBox2.Left -= 3;
if (this.pictureBox2.Right < 0)
{
this.pictureBox2.Left = this.Width;
}
}
private void button4_Click(object sender, EventArgs e)
{
this.timer1.Stop();
}
}
}
C#--不断向左移动的小动画之猫鼠赛跑
最新推荐文章于 2024-07-07 22:07:04 发布