Пример #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
            {
                listBox1.SelectedIndex++;
                fensterBilderschau.BildLaden(listBox1.SelectedItem.ToString());
                fensterBilderschau.Text = $"Bilderschau  Bild {listBox1.SelectedIndex + 1} von {listBox1.Items.Count} {listBox1.SelectedItem}";

                System.Media.SystemSounds.Asterisk.Play();
            }

            else
            {
                listBox1.SelectedIndex = -1;
                timer1.Stop();
                fensterBilderschau.Close();
            }
        }
Пример #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     //ist der letzte Eintrag noch nicht erreicht
     if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
     {
         //den nächsten Eintrag markieren
         listBox1.SelectedIndex++;
         //und das Bild laden
         fensterBilderschau.BildLaden(listBox1.SelectedItem.ToString());
         fensterBilderschau.Text = "Bilderschau - " + "Bild " + (listBox1.SelectedIndex + 1) + " von " + listBox1.Items.Count + " " + (listBox1.SelectedItem.ToString());
         System.Media.SystemSounds.Asterisk.Play();
     }
     //beim letzten Bild wieder aufräumen
     else
     {
         //die Markierung löschen
         listBox1.SelectedIndex = -1;
         //den Timer stoppen
         timer1.Stop();
         //das Fenster Bilderschau schließen
         fensterBilderschau.Close();
     }
 }