using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Timer
{
    public partial class Timer : Form
    {
        public Timer()
        {
            InitializeComponent();
        }
        int days;
        int hours;
        int mins;
        int seconds;
        private void Timer_Load(object sender, EventArgs e)
        {
            List<int> listYear = new List<int>();
            ; i < ; i++)
            {
                listYear.Add(i);
            }
            comboBox1.DataSource = listYear;

            label1.ForeColor = Color.Red;
            label2.ForeColor = Color.Green;
            label3.ForeColor = Color.Yellow;
            label4.ForeColor = Color.Blue;
            label5.ForeColor = Color.Brown;
            button1.Visible = false;

            ; //设置间隔时间,为1000毫秒;
            this.timer1.Tick += new System.EventHandler(this.button1_Click);////设置每间隔3000毫秒(3秒)执行一次函数timer1_Tick

            this.timer1.Start();
        }

        private void button1_Click(object sender, EventArgs e)
        {
             && hours >=  && mins >= )
            {
                seconds--;
                label4.Text = seconds.ToString() + "秒";
                label5.Text = (days *  *  + hours *  + mins *  + seconds).ToString() + "秒";
                )
                {
                    mins--;
                    seconds = ;
                    label3.Text = mins.ToString() +"分";
                    )
                    {
                        hours--;
                        mins = ;
                        label2.Text = hours.ToString() + "时";
                        )
                        {
                            days--;
                            hours = ;
                            label1.Text = days.ToString() + "天";
                        }
                    }
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form frm = new GetHome();
            frm.Show();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            List<int> listMonth = new List<int>();
            ; i < ; i++)
            {
                listMonth.Add(i);
            }
            comboBox2.DataSource = listMonth;
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            List<int> listDay = new List<int>();
            switch (comboBox2.Text)
            {
                 ":
                ":
                ":
                ":
                ":
                ":
                ":
                    ; i < ; i++)
                    {
                        listDay.Add(i);
                    }
                    break;
                ":
                     ==  && Convert.ToInt32(comboBox1.SelectedValue) %  != ) || Convert.ToInt32(comboBox1.SelectedValue) %  == )
                    {
                        ; i < ; i++)
                        {
                            listDay.Add(i);
                        }
                    }
                    else
                    {
                        ; i < ; i++)
                        {
                            listDay.Add(i);
                        }
                    }
                    break;
                ":
                ":
                ":
                ":
                    ; i < ; i++)
                    {
                        listDay.Add(i);
                    }
                    break;
            }
            comboBox3.DataSource = listDay;
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            DateTime dt1 = , , );
            DateTime dt2 = DateTime.Now;
            comboBox1.Text = dt2.Year.ToString();
            TimeSpan ts = dt1.Subtract(dt2);
            days = ts.Days;
            hours = ts.Hours;
            mins = ts.Minutes;
            seconds = ts.Seconds;
            label1.Text = days.ToString() + "天";
            label2.Text = hours.ToString() + "时";
            label3.Text = mins.ToString() + "分";
            label4.Text = seconds.ToString() + "秒";
            label5.Text = (days *  *  + hours *  + mins *  + seconds).ToString() + "秒";
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace Timer
{
    public partial class GetHome : Form
    {
        public GetHome()
        {
            InitializeComponent();
        }
        int time;
        private void GetHome_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;
            button1.Visible = false;
            DateTime dt = DateTime.Now;
            int day = dt.Day;
            int year = dt.Year;
            int month = dt.Month;
            DateTime dt1 = ,,);
            TimeSpan ts = dt1.Subtract(dt);
            time = ts.Hours *  + ts.Minutes *  + ts.Seconds;
            label1.Text = time.ToString() + "s";

            timer1.Interval = ;
            timer1.Tick += new System.EventHandler(this.button1_Click);
            timer1.Start();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            )
            {
                time--;
                string s = time.ToString();
                char[] str = s.ToCharArray();
                List<char> list = new List<char>();
                list.AddRange(str);
                )
                {
                    list.Insert(, ');
                }
                label1.Text = list[].ToString();
                label2.Text = list[].ToString();
                label3.Text = list[].ToString();
                label4.Text = list[].ToString();
                label5.Text = list[].ToString();
                label6.Text = "s";
                Thread th1 = new Thread(RandomColor);
                th1.IsBackground = true;
                th1.Start();
                Thread th2 = new Thread(RandomLocation);
                th2.IsBackground = true;
                th2.Start();
                )
                {
                    timer1.Stop();
                }
            }
        }
        void RandomColor()
        {
             Random r = new Random();
            , );
            , );
            Color c = new Color();
            switch (i)
            {
                :
                    c = Color.Blue;
                    break;
                :
                    c = Color.Purple;
                    break;
                :
                    c = Color.Brown;
                    break;
                :
                    c= Color.Pink;
                    break;
                :
                    c = Color.Red;
                    break;
                :
                    c = Color.Yellow;
                    break;
            }
            switch (i1)
            {
                :
                    label1.ForeColor = c;
                    break;
                :
                    label2.ForeColor = c;
                    break;
                :
                    label3.ForeColor = c;
                    break;
                :
                    label4.ForeColor = c;
                    break;
                :
                    label5.ForeColor = c;
                    break;
                :
                    label6.ForeColor = c;
                    break;
            }
        }
        void RandomLocation()
        {
            Random r = new Random();
            , );
            //int j = r.Next(0, 300);
            Point p = ,i);
            label1.Location = p;
            , );
            //int j1 = r.Next(0, 300);
            Point p1 = , i1);
            label2.Location = p1;
            , );
            //int j2 = r.Next(0, 300);
            Point p2 = ,i2);
            label3.Location = p2;
            , );
            //int j3 = r.Next(0, 300);
            Point p3 = ,i3);
            label4.Location = p3;
            , );
            //int j4 = r.Next(0, 300);
            Point p4 = ,i4);
            label5.Location = p4;
            , );
            //int j5 = r.Next(0, 300);
            Point p5 = ,i5);
            label6.Location = p5;
        }
    }
}
04-02 02:49