예제 #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     Panel[] arr = Controls
                   .OfType <Panel>()
                   .Where(panel => Regex.IsMatch(panel.Name, "^panel([0-9]|(10))$"))
                   .ToArray();
     clearAllLed();
     algorithmCount++;
     if (algorithmNumber == 1)
     {
         if (algorithmCount == 1)
         {
             panel8.BackColor = Color.Red;
         }
         else if (algorithmCount == 2)
         {
             panel7.BackColor = Color.Red;
         }
         else if (algorithmCount == 3)
         {
             panel6.BackColor = Color.Red;
         }
         else if (algorithmCount == 4)
         {
             panel5.BackColor = Color.Red;
         }
         else if (algorithmCount == 5)
         {
             panel4.BackColor = Color.Red;
         }
         else if (algorithmCount == 6)
         {
             panel3.BackColor = Color.Red;
         }
         else if (algorithmCount == 7)
         {
             panel2.BackColor = Color.Red;
         }
         else if (algorithmCount == 8)
         {
             panel1.BackColor = Color.Red;
         }
     }
     if (algorithmNumber == 2)
     {
         if (algorithmCount == 1)
         {
             panel8.BackColor = Color.Red;
         }
         else if (algorithmCount == 2)
         {
             panel1.BackColor = Color.Red;
         }
         else if (algorithmCount == 3)
         {
             panel7.BackColor = Color.Red;
         }
         else if (algorithmCount == 4)
         {
             panel2.BackColor = Color.Red;
         }
         else if (algorithmCount == 5)
         {
             panel6.BackColor = Color.Red;
         }
         else if (algorithmCount == 6)
         {
             panel3.BackColor = Color.Red;
         }
         else if (algorithmCount == 7)
         {
             panel5.BackColor = Color.Red;
         }
         else if (algorithmCount == 8)
         {
             panel4.BackColor = Color.Red;
         }
     }
 }
예제 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     Controls.OfType <TextBox>().ToList().ForEach(t => t.Clear());
 }