Beispiel #1
0
 private dateData[,] CalculationYear(DateTime now)
 {
     dateData[,] texts3 = new dateData[2, 5];
     texts3[0, 0]       = new dateData(now.Year - 9 + "年", new DateTime(now.Year - 9, 1, 1), new DateTime(now.Year - 9 + 1, 1, 1).AddDays(-1));
     texts3[0, 1]       = new dateData(now.Year - 8 + "年", new DateTime(now.Year - 8, 1, 1), new DateTime(now.Year - 8 + 1, 1, 1).AddDays(-1));
     texts3[0, 2]       = new dateData(now.Year - 7 + "年", new DateTime(now.Year - 7, 1, 1), new DateTime(now.Year - 7 + 1, 1, 1).AddDays(-1));
     texts3[0, 3]       = new dateData(now.Year - 6 + "年", new DateTime(now.Year - 6, 1, 1), new DateTime(now.Year - 6 + 1, 1, 1).AddDays(-1));
     texts3[0, 4]       = new dateData(now.Year - 5 + "年", new DateTime(now.Year - 5, 1, 1), new DateTime(now.Year - 5 + 1, 1, 1).AddDays(-1));
     texts3[1, 0]       = new dateData(now.Year - 4 + "年", new DateTime(now.Year - 4, 1, 1), new DateTime(now.Year - 4 + 1, 1, 1).AddDays(-1));
     texts3[1, 1]       = new dateData(now.Year - 3 + "年", new DateTime(now.Year - 3, 1, 1), new DateTime(now.Year - 3 + 1, 1, 1).AddDays(-1));
     texts3[1, 2]       = new dateData(now.Year - 2 + "年", new DateTime(now.Year - 2, 1, 1), new DateTime(now.Year - 2 + 1, 1, 1).AddDays(-1));
     texts3[1, 3]       = new dateData(now.Year - 1 + "年", new DateTime(now.Year - 1, 1, 1), new DateTime(now.Year - 1 + 1, 1, 1).AddDays(-1));
     texts3[1, 4]       = new dateData(now.Year + "年", new DateTime(now.Year, 1, 1), new DateTime(now.Year + 1, 1, 1).AddDays(-1));
     return(texts3);
 }
Beispiel #2
0
        private void InitControl()
        {
            dateData[,] texts = new dateData[2, 4];
            texts[0, 0]       = new dateData("今天", Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")));
            texts[0, 1]       = new dateData("昨天", Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00")), Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
            texts[0, 2]       = new dateData("近两天", Convert.ToDateTime(DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00")), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")));
            texts[0, 3]       = new dateData("近三天", Convert.ToDateTime(DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd 00:00:00")), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")));
            texts[1, 0]       = CalculationDate(DateTime.Now, "本周");
            texts[1, 1]       = CalculationDate(DateTime.Now, "本月");
            texts[1, 2]       = CalculationDate(DateTime.Now, "本季度");
            texts[1, 3]       = CalculationDate(DateTime.Now, "本年度");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 4; k++)
                {
                    if (texts[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle    = FlatStyle.Flat;
                        btn.Text         = texts[i, k].name;
                        btn.Tag          = texts[i, k];
                        btn.Font         = new Font("宋体", 9);
                        btn.AutoSize     = true;
                        btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        btn.Click       += new EventHandler(btn_Click);
                        tableLayoutPanel1.Controls.Add(btn, k, i);
                    }
                }
            }


            dateData[,] texts1 = new dateData[2, 6];
            texts1[0, 0]       = CalculationDate(DateTime.Now, "一月");
            texts1[0, 1]       = CalculationDate(DateTime.Now, "二月");
            texts1[0, 2]       = CalculationDate(DateTime.Now, "三月");
            texts1[0, 3]       = CalculationDate(DateTime.Now, "四月");
            texts1[0, 4]       = CalculationDate(DateTime.Now, "五月");
            texts1[0, 5]       = CalculationDate(DateTime.Now, "六月");
            texts1[1, 0]       = CalculationDate(DateTime.Now, "七月");
            texts1[1, 1]       = CalculationDate(DateTime.Now, "八月");
            texts1[1, 2]       = CalculationDate(DateTime.Now, "九月");
            texts1[1, 3]       = CalculationDate(DateTime.Now, "十月");
            texts1[1, 4]       = CalculationDate(DateTime.Now, "十一月");
            texts1[1, 5]       = CalculationDate(DateTime.Now, "十二月");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 6; k++)
                {
                    if (texts1[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle    = FlatStyle.Flat;
                        btn.Text         = texts1[i, k].name;
                        btn.Tag          = texts1[i, k];
                        btn.Font         = new Font("宋体", 9);
                        btn.AutoSize     = true;
                        btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        btn.Click       += new EventHandler(btn_Click);
                        tableLayoutPanel2.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts2 = new dateData[2, 2];
            texts2[0, 0]       = CalculationDate(DateTime.Now, "一季度");
            texts2[0, 1]       = CalculationDate(DateTime.Now, "二季度");
            texts2[1, 0]       = CalculationDate(DateTime.Now, "三季度");
            texts2[1, 1]       = CalculationDate(DateTime.Now, "四季度");
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 2; k++)
                {
                    if (texts2[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle    = FlatStyle.Flat;
                        btn.Text         = texts2[i, k].name;
                        btn.Tag          = texts2[i, k];
                        btn.Font         = new Font("宋体", 9);
                        btn.AutoSize     = true;
                        btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        btn.Click       += new EventHandler(btn_Click);
                        tableLayoutPanel3.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts3 = CalculationYear(DateTime.Now);
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 5; k++)
                {
                    if (texts3[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle    = FlatStyle.Flat;
                        btn.Text         = texts3[i, k].name;
                        btn.Tag          = texts3[i, k];
                        btn.Font         = new Font("宋体", 9);
                        btn.AutoSize     = true;
                        btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        btn.Click       += new EventHandler(btn_Click);
                        tableLayoutPanel4.Controls.Add(btn, k, i);
                    }
                }
            }
        }
        private void InitControl()
        {
            dateData[,] texts = new dateData[2, 4];
            texts[0, 0] = new dateData("今天", DateTime.Now, DateTime.Now);
            texts[0, 1] = new dateData("昨天", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-1));
            texts[0, 2] = new dateData("近两天", DateTime.Now.AddDays(-2), DateTime.Now);
            texts[0, 3] = new dateData("近三天", DateTime.Now.AddDays(-3), DateTime.Now);
            texts[1, 0] = CalculationDate(DateTime.Now, "本周");
            texts[1, 1] = CalculationDate(DateTime.Now, "本月");
            texts[1, 2] = CalculationDate(DateTime.Now, "本季度");
            texts[1, 3] = CalculationDate(DateTime.Now, "本年度");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 4; k++)
                {
                    if (texts[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text = texts[i, k].name;
                        btn.Tag = texts[i, k];
                        btn.Click += new EventHandler(btn_Click);
                        tableLayoutPanel1.Controls.Add(btn, k, i);
                    }
                }
            }


            dateData[,] texts1 = new dateData[2, 6];
            texts1[0, 0] = CalculationDate(DateTime.Now, "一月");
            texts1[0, 1] = CalculationDate(DateTime.Now, "二月");
            texts1[0, 2] = CalculationDate(DateTime.Now, "三月");
            texts1[0, 3] = CalculationDate(DateTime.Now, "四月");
            texts1[0, 4] = CalculationDate(DateTime.Now, "五月");
            texts1[0, 5] = CalculationDate(DateTime.Now, "六月");
            texts1[1, 0] = CalculationDate(DateTime.Now, "七月");
            texts1[1, 1] = CalculationDate(DateTime.Now, "八月");
            texts1[1, 2] = CalculationDate(DateTime.Now, "九月");
            texts1[1, 3] = CalculationDate(DateTime.Now, "十月");
            texts1[1, 4] = CalculationDate(DateTime.Now, "十一月");
            texts1[1, 5] = CalculationDate(DateTime.Now, "十二月");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 6; k++)
                {
                    if (texts1[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text = texts1[i, k].name;
                        btn.Tag = texts1[i, k];
                        btn.Click += new EventHandler(btn_Click);
                        tableLayoutPanel2.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts2 = new dateData[2, 2];
            texts2[0, 0] = CalculationDate(DateTime.Now, "一季度");
            texts2[0, 1] = CalculationDate(DateTime.Now, "二季度");
            texts2[1, 0] = CalculationDate(DateTime.Now, "三季度");
            texts2[1, 1] = CalculationDate(DateTime.Now, "四季度");
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 2; k++)
                {
                    if (texts2[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text = texts2[i, k].name;
                        btn.Tag = texts2[i, k];
                        btn.Click += new EventHandler(btn_Click);
                        tableLayoutPanel3.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts3 = CalculationYear(DateTime.Now);
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 5; k++)
                {
                    if (texts3[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text = texts3[i, k].name;
                        btn.Tag = texts3[i, k];
                        btn.Click += new EventHandler(btn_Click);
                        tableLayoutPanel4.Controls.Add(btn, k, i);
                    }
                }
            }
        }
Beispiel #4
0
        private void InitControl()
        {
            dateData[,] texts = new dateData[2, 4];
            texts[0, 0]       = new dateData("今天", DateTime.Now, DateTime.Now);
            texts[0, 1]       = new dateData("昨天", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-1));
            texts[0, 2]       = new dateData("近两天", DateTime.Now.AddDays(-2), DateTime.Now);
            texts[0, 3]       = new dateData("近三天", DateTime.Now.AddDays(-3), DateTime.Now);
            texts[1, 0]       = CalculationDate(DateTime.Now, "本周");
            texts[1, 1]       = CalculationDate(DateTime.Now, "本月");
            texts[1, 2]       = CalculationDate(DateTime.Now, "本季度");
            texts[1, 3]       = CalculationDate(DateTime.Now, "本年度");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 4; k++)
                {
                    if (texts[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text      = texts[i, k].name;
                        btn.Tag       = texts[i, k];
                        btn.Click    += new EventHandler(btn_Click);
                        tableLayoutPanel1.Controls.Add(btn, k, i);
                    }
                }
            }


            dateData[,] texts1 = new dateData[2, 6];
            texts1[0, 0]       = CalculationDate(DateTime.Now, "一月");
            texts1[0, 1]       = CalculationDate(DateTime.Now, "二月");
            texts1[0, 2]       = CalculationDate(DateTime.Now, "三月");
            texts1[0, 3]       = CalculationDate(DateTime.Now, "四月");
            texts1[0, 4]       = CalculationDate(DateTime.Now, "五月");
            texts1[0, 5]       = CalculationDate(DateTime.Now, "六月");
            texts1[1, 0]       = CalculationDate(DateTime.Now, "七月");
            texts1[1, 1]       = CalculationDate(DateTime.Now, "八月");
            texts1[1, 2]       = CalculationDate(DateTime.Now, "九月");
            texts1[1, 3]       = CalculationDate(DateTime.Now, "十月");
            texts1[1, 4]       = CalculationDate(DateTime.Now, "十一月");
            texts1[1, 5]       = CalculationDate(DateTime.Now, "十二月");

            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 6; k++)
                {
                    if (texts1[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text      = texts1[i, k].name;
                        btn.Tag       = texts1[i, k];
                        btn.Click    += new EventHandler(btn_Click);
                        tableLayoutPanel2.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts2 = new dateData[2, 2];
            texts2[0, 0]       = CalculationDate(DateTime.Now, "一季度");
            texts2[0, 1]       = CalculationDate(DateTime.Now, "二季度");
            texts2[1, 0]       = CalculationDate(DateTime.Now, "三季度");
            texts2[1, 1]       = CalculationDate(DateTime.Now, "四季度");
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 2; k++)
                {
                    if (texts2[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text      = texts2[i, k].name;
                        btn.Tag       = texts2[i, k];
                        btn.Click    += new EventHandler(btn_Click);
                        tableLayoutPanel3.Controls.Add(btn, k, i);
                    }
                }
            }

            dateData[,] texts3 = CalculationYear(DateTime.Now);
            for (int i = 0; i < 2; i++)
            {
                for (int k = 0; k < 5; k++)
                {
                    if (texts3[i, k].name != "")
                    {
                        Button btn = new Button();
                        btn.FlatStyle = FlatStyle.Flat;
                        btn.Text      = texts3[i, k].name;
                        btn.Tag       = texts3[i, k];
                        btn.Click    += new EventHandler(btn_Click);
                        tableLayoutPanel4.Controls.Add(btn, k, i);
                    }
                }
            }
        }
 private dateData[,] CalculationYear(DateTime now)
 {
     dateData[,] texts3 = new dateData[2, 5];
     texts3[0, 0] = new dateData(now.Year - 9 + "年", new DateTime(now.Year - 9, 1, 1), new DateTime(now.Year - 9 + 1, 1, 1).AddDays(-1));
     texts3[0, 1] = new dateData(now.Year - 8 + "年", new DateTime(now.Year - 8, 1, 1), new DateTime(now.Year - 8 + 1, 1, 1).AddDays(-1));
     texts3[0, 2] = new dateData(now.Year - 7 + "年", new DateTime(now.Year - 7, 1, 1), new DateTime(now.Year - 7 + 1, 1, 1).AddDays(-1));
     texts3[0, 3] = new dateData(now.Year - 6 + "年", new DateTime(now.Year - 6, 1, 1), new DateTime(now.Year - 6 + 1, 1, 1).AddDays(-1));
     texts3[0, 4] = new dateData(now.Year - 5 + "年", new DateTime(now.Year - 5, 1, 1), new DateTime(now.Year - 5 + 1, 1, 1).AddDays(-1));
     texts3[1, 0] = new dateData(now.Year - 4 + "年", new DateTime(now.Year - 4, 1, 1), new DateTime(now.Year - 4 + 1, 1, 1).AddDays(-1));
     texts3[1, 1] = new dateData(now.Year - 3 + "年", new DateTime(now.Year - 3, 1, 1), new DateTime(now.Year - 3 + 1, 1, 1).AddDays(-1));
     texts3[1, 2] = new dateData(now.Year - 2 + "年", new DateTime(now.Year - 2, 1, 1), new DateTime(now.Year - 2 + 1, 1, 1).AddDays(-1));
     texts3[1, 3] = new dateData(now.Year - 1 + "年", new DateTime(now.Year - 1, 1, 1), new DateTime(now.Year - 1 + 1, 1, 1).AddDays(-1));
     texts3[1, 4] = new dateData(now.Year + "年", new DateTime(now.Year, 1, 1), new DateTime(now.Year + 1, 1, 1).AddDays(-1));
     return texts3;
 }