areyesram

Untitled

Sep 29th, 2020
886
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Drawing;
  2. using System.Windows.Forms;
  3.  
  4. namespace WindowsFormsApplication3
  5. {
  6.     public partial class Form1 : Form
  7.     {
  8.         private readonly Button[] buttons;
  9.         private int current;
  10.  
  11.         public Form1()
  12.         {
  13.             InitializeComponent();
  14.             buttons = new[]
  15.             {
  16.                 button1, button2, button3, button4,
  17.                 button5, button6, button7, button8,
  18.                 button9, button10, button11, button12
  19.             };
  20.         }
  21.  
  22.         private void timer1_Tick(object sender, System.EventArgs e)
  23.         {
  24.             if (current >= buttons.Length)
  25.                 current = 0;
  26.             var button = buttons[current];
  27.             button.BackColor = button.BackColor == Color.LightGreen ? Color.Yellow : Color.LightGreen;
  28.             current++;
  29.         }
  30.     }
  31. }
RAW Paste Data