Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1.     public partial class Form1 : Form
  2.     {
  3.         int imageNumber = 0;
  4.  
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.  
  10.         private void Form1_Load(object sender, EventArgs e)
  11.         {
  12.  
  13.         }
  14.  
  15.         private void button1_Click(object sender, EventArgs e)
  16.         {
  17.             timer1.Start();
  18.         }
  19.  
  20.         private void button2_Click(object sender, EventArgs e)
  21.         {
  22.             timer1.Stop();
  23.         }
  24.  
  25.         private void timer1_Tick(object sender, EventArgs e)
  26.         {
  27.             if (imageNumber == imageList1.Images.Count - 1)
  28.             {
  29.                 imageNumber = 0;
  30.             }
  31.             imageNumber++;
  32.  
  33.             pictureBox1.Image = imageList1.Images[imageNumber];
  34.  
  35.             textBox1.Text = imageNumber.ToString();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement