示例#1
0
 private void TextBoxHeures_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     // Si Entrer est pressé, on valide la date
     if (e.Key == Key.Enter || e.Key == Key.Space)
     {
         TextBoxMinutes.Focus();
     }
     else if (e.Key == Key.Delete)
     {
         TextBoxHeures.Text = "0";
     }
     else if (e.Key == Key.Right && TextBoxHeures.CaretIndex == TextBoxHeures.Text.Length)
     {
         TextBoxMinutes.Focus();
         TextBoxMinutes.CaretIndex = 0;
     }
     else if (e.Key == Key.Up)
     {
         TextBoxHeures.Text = UpDown(TextBoxHeures.Text, 1, 23);
     }
     else if (e.Key == Key.Down)
     {
         TextBoxHeures.Text = UpDown(TextBoxHeures.Text, -1, 23);
     }
 }
示例#2
0
 private void TextBoxSecondes_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     // Si Entrer est pressé, on valide la date
     if (e.Key == Key.Enter || e.Key == Key.Space || e.Key == Key.Tab)
     {
         buttonProgrammerExtinction.Focus();
     }
     else if (e.Key == Key.Delete)
     {
         TextBoxSecondes.Text = "0";
     }
     else if (e.Key == Key.Left && TextBoxSecondes.CaretIndex == 0)
     {
         TextBoxMinutes.Focus();
         TextBoxMinutes.CaretIndex = TextBoxMinutes.Text.Length;
     }
     else if (e.Key == Key.Up)
     {
         TextBoxSecondes.Text = UpDown(TextBoxSecondes.Text, 1, 59);
     }
     else if (e.Key == Key.Down)
     {
         TextBoxSecondes.Text = UpDown(TextBoxSecondes.Text, -1, 59);
     }
 }