示例#1
0
文件: Form1.cs 项目: djock/hackathome
        private void timer1_Tick(object sender, EventArgs e)
        {
            int min1, sec1;

            int.TryParse(min.Text, out min1);
            int.TryParse(sec.Text, out sec1);

            if (min1 == 0 && sec1 == 0)
            {
                SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
                simpleSound.Play();
                this.Close();
                System.Drawing.Size windowSize =
                    SystemInformation.PrimaryMonitorMaximizedWindowSize;
                Form2 pause = new Form2();
                pause.Show();
                pause.StartPosition = FormStartPosition.Manual;
                pause.SetDesktopLocation(windowSize.Width - 270, windowSize.Height - 220);
                pause.ShowInTaskbar = true;
                pause.WindowState   = FormWindowState.Normal;
                pause.Height        = 200;
                pause.Width         = 250;
            }
            if (sec1 < 1)
            {
                sec1 = 59;
                min1--;
            }
            else
            {
                sec1--;
            }
            if (min1 < 10)
            {
                min.Text = "0" + min1.ToString();
            }
            else
            {
                min.Text = min1.ToString();
            }
            if (sec1 < 10)
            {
                sec.Text = "0" + sec1.ToString();
            }
            else
            {
                sec.Text = sec1.ToString();
            }
        }