using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace exp4_6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { timer1.Start(); timer1.Interval = 1000; } //全域變數 int num = 10; int pic = 1; int x = 88; private void timer1_Tick(object sender, EventArgs e) { //區域變數 num -= 1; if(num==0) { timer1.Stop(); } label1.Text = num.ToString(); } private void button1_Click(object sender, EventArgs e) { //切換圖片 timer2.Start(); timer2.Interval = 100; //向右移動 timer3.Start(); timer3.Interval = 100; } private void timer2_Tick(object sender, EventArgs e) { pic += 1; if(pic==13)pic = 1; if(pic==1) { pictureBox1.Image = exp4_6.Properties.Resources.cat0001; } else if(pic==2) { pictureBox1.Image = exp4_6.Properties.Resources.cat0002; } else if (pic == 3) { pictureBox1.Image = exp4_6.Properties.Resources.cat0003; } else if (pic == 4) { pictureBox1.Image = exp4_6.Properties.Resources.cat0004; } else if (pic == 5) { pictureBox1.Image = exp4_6.Properties.Resources.cat0005; } else if (pic == 6) { pictureBox1.Image = exp4_6.Properties.Resources.cat0006; } else if (pic == 7) { pictureBox1.Image = exp4_6.Properties.Resources.cat0007; } else if (pic == 8) { pictureBox1.Image = exp4_6.Properties.Resources.cat0008; } else if (pic == 9) { pictureBox1.Image = exp4_6.Properties.Resources.cat0009; } else if (pic == 10) { pictureBox1.Image = exp4_6.Properties.Resources.cat0010; } else if (pic == 11) { pictureBox1.Image = exp4_6.Properties.Resources.cat0011; } else if (pic == 12) { pictureBox1.Image = exp4_6.Properties.Resources.cat0012; } } private void timer3_Tick(object sender, EventArgs e) { x += 6; if(x > this.Width) x = 0; pictureBox1.Location = new Point(x, 122); } } }