自定義Calendar

来源:互联网 发布:数据分析报告的范文 编辑:程序博客网 时间:2024/04/30 17:23

Calendar控件,個人認為還是戀不錯的控件,特別是用於在考勤排班或生產排班上,非常有用,花了幾個種的時間寫了一個,基本一致,下面將此功能說明如下:

第一,要實現此功能,則要先定義一個擴展的Button控件,添加幾個屬性,讓其存儲對應的年月日

第二,然后繪制一個Calendar控件的界面顯示

第三,實現將日期數據在界面上的顯示

這樣此功能就實現了。代碼如下:

擴展Bu

 

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

namespace Custom
{

    
public partial class CustomButton : Button
    
{
        
private String customDate;
        
private String customYear;
        
private String customMonth;
        
private String customDay;

        
public CustomButton()
        
{
            
this.FlatStyle = FlatStyle.Flat;
        }


        [Browsable(
true), Category("Custom"), Description("定制日期,其值为字符型,日期格式为YYYY-MM-DD")]
        
public String CustomDate 
        
{
            
set { customDate = value; }
            
get return customDate; }
        }


        [Browsable(
true), Category("Custom"), Description("定制年,其值为字符型,格式为YYYY")]
        
        
public String CustomYear
        
{
            
set { customYear = value; }
            
get return customYear; }
        }

        [Browsable(
true), Category("Custom"), Description("定制月,其值为字符型,格式为MM")]

        
public String CustomMonth
        
{
            
set { customMonth = value; }
            
get return customMonth; }
        }

        [Browsable(
true), Category("Custom"), Description("定制日,其值为字符型,格式为DD")]
        
        
public String CustomDay
        
{
            
set { customDay = value; }
            
get return customDay; }
        }


        
    }

}

 

2)繪制控件的文件原代碼:

namespace Custom
{
    partial class UCCustomCalendar
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region 组件设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.lblWed = new System.Windows.Forms.Label();
            this.lblTues = new System.Windows.Forms.Label();
            this.lblMon = new System.Windows.Forms.Label();
            this.lblThurs = new System.Windows.Forms.Label();
            this.cmdNext = new System.Windows.Forms.Button();
            this.cmdPrevious = new System.Windows.Forms.Button();
            this.panelWeek = new System.Windows.Forms.Panel();
            this.YearUD = new System.Windows.Forms.NumericUpDown();
            this.label4 = new System.Windows.Forms.Label();
            this.txtMonth = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.txtCurrDate = new System.Windows.Forms.TextBox();
            this.lblSat = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.label2 = new System.Windows.Forms.Label();
            this.lblFriday = new System.Windows.Forms.Label();
            this.lblCurrendDate = new System.Windows.Forms.Label();
            this.cb57 = new Custom.CustomButton();
            this.cb47 = new Custom.CustomButton();
            this.cb37 = new Custom.CustomButton();
            this.cb27 = new Custom.CustomButton();
            this.cb17 = new Custom.CustomButton();
            this.cb07 = new Custom.CustomButton();
            this.cb02 = new Custom.CustomButton();
            this.cb01 = new Custom.CustomButton();
            this.cb56 = new Custom.CustomButton();
            this.cb55 = new Custom.CustomButton();
            this.cb54 = new Custom.CustomButton();
            this.cb53 = new Custom.CustomButton();
            this.cb52 = new Custom.CustomButton();
            this.cb51 = new Custom.CustomButton();
            this.cb46 = new Custom.CustomButton();
            this.cb45 = new Custom.CustomButton();
            this.cb44 = new Custom.CustomButton();
            this.cb43 = new Custom.CustomButton();
            this.cb42 = new Custom.CustomButton();
            this.cb41 = new Custom.CustomButton();
            this.cb36 = new Custom.CustomButton();
            this.cb35 = new Custom.CustomButton();
            this.cb34 = new Custom.CustomButton();
            this.cb33 = new Custom.CustomButton();
            this.cb32 = new Custom.CustomButton();
            this.cb31 = new Custom.CustomButton();
            this.cb26 = new Custom.CustomButton();
            this.cb25 = new Custom.CustomButton();
            this.cb22 = new Custom.CustomButton();
            this.cb21 = new Custom.CustomButton();
            this.cb16 = new Custom.CustomButton();
            this.cb15 = new Custom.CustomButton();
            this.cb14 = new Custom.CustomButton();
            this.cb24 = new Custom.CustomButton();
            this.cb23 = new Custom.CustomButton();
            this.cb13 = new Custom.CustomButton();
            this.cb12 = new Custom.CustomButton();
            this.cb11 = new Custom.CustomButton();
            this.cb06 = new Custom.CustomButton();
            this.cb05 = new Custom.CustomButton();
            this.cb04 = new Custom.CustomButton();
            this.cb03 = new Custom.CustomButton();
            this.panelWeek.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.YearUD)).BeginInit();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Cursor = System.Windows.Forms.Cursors.Default;
            this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(47, 195);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(38, 12);
            this.label1.TabIndex = 77;
            this.label1.Text = "今天:";
            //
            // lblWed
            //
            this.lblWed.AutoSize = true;
            this.lblWed.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblWed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblWed.Location = new System.Drawing.Point(144, 7);
            this.lblWed.Name = "lblWed";
            this.lblWed.Size = new System.Drawing.Size(41, 12);
            this.lblWed.TabIndex = 2;
            this.lblWed.Text = "星期三";
            //
            // lblTues
            //
            this.lblTues.AutoSize = true;
            this.lblTues.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblTues.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblTues.Location = new System.Drawing.Point(97, 7);
            this.lblTues.Name = "lblTues";
            this.lblTues.Size = new System.Drawing.Size(41, 12);
            this.lblTues.TabIndex = 1;
            this.lblTues.Text = "星期二";
            //
            // lblMon
            //
            this.lblMon.AutoSize = true;
            this.lblMon.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblMon.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblMon.Location = new System.Drawing.Point(3, 7);
            this.lblMon.Name = "lblMon";
            this.lblMon.Size = new System.Drawing.Size(41, 12);
            this.lblMon.TabIndex = 0;
            this.lblMon.Text = "星期日";
            //
            // lblThurs
            //
            this.lblThurs.AutoSize = true;
            this.lblThurs.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblThurs.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblThurs.Location = new System.Drawing.Point(191, 7);
            this.lblThurs.Name = "lblThurs";
            this.lblThurs.Size = new System.Drawing.Size(41, 12);
            this.lblThurs.TabIndex = 3;
            this.lblThurs.Text = "星期四";
            //
            // cmdNext
            //
            this.cmdNext.BackColor = System.Drawing.SystemColors.Control;
            this.cmdNext.Cursor = System.Windows.Forms.Cursors.Default;
            this.cmdNext.Location = new System.Drawing.Point(302, 0);
            this.cmdNext.Name = "cmdNext";
            this.cmdNext.Size = new System.Drawing.Size(27, 24);
            this.cmdNext.TabIndex = 1;
            this.cmdNext.Text = "►";
            this.cmdNext.UseVisualStyleBackColor = false;
            this.cmdNext.Click += new System.EventHandler(this.cmdNext_Click);
            //
            // cmdPrevious
            //
            this.cmdPrevious.BackColor = System.Drawing.SystemColors.Control;
            this.cmdPrevious.Cursor = System.Windows.Forms.Cursors.Default;
            this.cmdPrevious.Location = new System.Drawing.Point(0, 0);
            this.cmdPrevious.Name = "cmdPrevious";
            this.cmdPrevious.Size = new System.Drawing.Size(24, 24);
            this.cmdPrevious.TabIndex = 0;
            this.cmdPrevious.Text = "◄";
            this.cmdPrevious.UseVisualStyleBackColor = false;
            this.cmdPrevious.Click += new System.EventHandler(this.cmdPrevious_Click);
            //
            // panelWeek
            //
            this.panelWeek.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
            this.panelWeek.Controls.Add(this.YearUD);
            this.panelWeek.Controls.Add(this.label4);
            this.panelWeek.Controls.Add(this.txtMonth);
            this.panelWeek.Controls.Add(this.label3);
            this.panelWeek.Controls.Add(this.txtCurrDate);
            this.panelWeek.Controls.Add(this.cmdNext);
            this.panelWeek.Controls.Add(this.cmdPrevious);
            this.panelWeek.Cursor = System.Windows.Forms.Cursors.Default;
            this.panelWeek.Location = new System.Drawing.Point(0, 3);
            this.panelWeek.Name = "panelWeek";
            this.panelWeek.Size = new System.Drawing.Size(329, 25);
            this.panelWeek.TabIndex = 39;
            //
            // YearUD
            //
            this.YearUD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.YearUD.Cursor = System.Windows.Forms.Cursors.Default;
            this.YearUD.Location = new System.Drawing.Point(208, 5);
            this.YearUD.Maximum = new decimal(new int[] {
            9999,
            0,
            0,
            0});
            this.YearUD.Minimum = new decimal(new int[] {
            1990,
            0,
            0,
            0});
            this.YearUD.Name = "YearUD";
            this.YearUD.Size = new System.Drawing.Size(18, 21);
            this.YearUD.TabIndex = 6;
            this.YearUD.Value = new decimal(new int[] {
            1990,
            0,
            0,
            0});
            this.YearUD.Visible = false;
            this.YearUD.LostFocus += new System.EventHandler(this.YearUD_LostFocus);
            this.YearUD.ValueChanged += new System.EventHandler(this.YearUD_ValueChanged);
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Cursor = System.Windows.Forms.Cursors.Default;
            this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label4.ForeColor = System.Drawing.SystemColors.Window;
            this.label4.Location = new System.Drawing.Point(187, 8);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(18, 12);
            this.label4.TabIndex = 5;
            this.label4.Text = "日";
            //
            // txtMonth
            //
            this.txtMonth.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
            this.txtMonth.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtMonth.Cursor = System.Windows.Forms.Cursors.Default;
            this.txtMonth.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtMonth.ForeColor = System.Drawing.SystemColors.Window;
            this.txtMonth.Location = new System.Drawing.Point(168, 8);
            this.txtMonth.Name = "txtMonth";
            this.txtMonth.ReadOnly = true;
            this.txtMonth.Size = new System.Drawing.Size(20, 14);
            this.txtMonth.TabIndex = 4;
            this.txtMonth.Text = "12";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Cursor = System.Windows.Forms.Cursors.Default;
            this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label3.ForeColor = System.Drawing.SystemColors.ControlLightLight;
            this.label3.Location = new System.Drawing.Point(150, 8);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(18, 12);
            this.label3.TabIndex = 3;
            this.label3.Text = "年";
            //
            // txtCurrDate
            //
            this.txtCurrDate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
            this.txtCurrDate.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtCurrDate.Cursor = System.Windows.Forms.Cursors.Default;
            this.txtCurrDate.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtCurrDate.ForeColor = System.Drawing.SystemColors.Window;
            this.txtCurrDate.Location = new System.Drawing.Point(118, 8);
            this.txtCurrDate.Name = "txtCurrDate";
            this.txtCurrDate.ReadOnly = true;
            this.txtCurrDate.Size = new System.Drawing.Size(31, 14);
            this.txtCurrDate.TabIndex = 2;
            this.txtCurrDate.Text = "2007";
            this.txtCurrDate.LostFocus += new System.EventHandler(this.txtCurrDate_LostFocus);
            this.txtCurrDate.GotFocus += new System.EventHandler(this.txtCurrDate_GotFocus);
            //
            // lblSat
            //
            this.lblSat.AutoSize = true;
            this.lblSat.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblSat.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblSat.Location = new System.Drawing.Point(285, 7);
            this.lblSat.Name = "lblSat";
            this.lblSat.Size = new System.Drawing.Size(41, 12);
            this.lblSat.TabIndex = 5;
            this.lblSat.Text = "星期六";
            //
            // panel1
            //
            this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.panel1.Controls.Add(this.label2);
            this.panel1.Controls.Add(this.lblSat);
            this.panel1.Controls.Add(this.lblFriday);
            this.panel1.Controls.Add(this.lblThurs);
            this.panel1.Controls.Add(this.lblWed);
            this.panel1.Controls.Add(this.lblTues);
            this.panel1.Controls.Add(this.lblMon);
            this.panel1.Cursor = System.Windows.Forms.Cursors.Default;
            this.panel1.Location = new System.Drawing.Point(0, 28);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(329, 25);
            this.panel1.TabIndex = 40;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Cursor = System.Windows.Forms.Cursors.Default;
            this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.label2.Location = new System.Drawing.Point(50, 7);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(41, 12);
            this.label2.TabIndex = 6;
            this.label2.Text = "星期一";
            //
            // lblFriday
            //
            this.lblFriday.AutoSize = true;
            this.lblFriday.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblFriday.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            this.lblFriday.Location = new System.Drawing.Point(238, 7);
            this.lblFriday.Name = "lblFriday";
            this.lblFriday.Size = new System.Drawing.Size(41, 12);
            this.lblFriday.TabIndex = 4;
            this.lblFriday.Text = "星期五";
            //
            // lblCurrendDate
            //
            this.lblCurrendDate.AutoSize = true;
            this.lblCurrendDate.Cursor = System.Windows.Forms.Cursors.Default;
            this.lblCurrendDate.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblCurrendDate.Location = new System.Drawing.Point(91, 195);
            this.lblCurrendDate.Name = "lblCurrendDate";
            this.lblCurrendDate.Size = new System.Drawing.Size(100, 12);
            this.lblCurrendDate.TabIndex = 84;
            this.lblCurrendDate.Text = "YYYY年MM月DD日";
            //
            // cb57
            //
            this.cb57.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb57.CustomDate = null;
            this.cb57.CustomDay = null;
            this.cb57.CustomMonth = null;
            this.cb57.CustomYear = null;
            this.cb57.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb57.Location = new System.Drawing.Point(282, 165);
            this.cb57.Name = "cb57";
            this.cb57.Size = new System.Drawing.Size(47, 23);
            this.cb57.TabIndex = 83;
            this.cb57.Text = "customButton6";
            this.cb57.UseVisualStyleBackColor = true;
            this.cb57.Click += new System.EventHandler(this.cb57_Click);
            //
            // cb47
            //
            this.cb47.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb47.CustomDate = null;
            this.cb47.CustomDay = null;
            this.cb47.CustomMonth = null;
            this.cb47.CustomYear = null;
            this.cb47.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb47.Location = new System.Drawing.Point(282, 142);
            this.cb47.Name = "cb47";
            this.cb47.Size = new System.Drawing.Size(47, 23);
            this.cb47.TabIndex = 82;
            this.cb47.Text = "customButton6";
            this.cb47.UseVisualStyleBackColor = true;
            this.cb47.Click += new System.EventHandler(this.cb47_Click);
            //
            // cb37
            //
            this.cb37.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb37.CustomDate = null;
            this.cb37.CustomDay = null;
            this.cb37.CustomMonth = null;
            this.cb37.CustomYear = null;
            this.cb37.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb37.Location = new System.Drawing.Point(282, 119);
            this.cb37.Name = "cb37";
            this.cb37.Size = new System.Drawing.Size(47, 23);
            this.cb37.TabIndex = 81;
            this.cb37.Text = "customButton6";
            this.cb37.UseVisualStyleBackColor = true;
            this.cb37.Click += new System.EventHandler(this.cb37_Click);
            //
            // cb27
            //
            this.cb27.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb27.CustomDate = null;
            this.cb27.CustomDay = null;
            this.cb27.CustomMonth = null;
            this.cb27.CustomYear = null;
            this.cb27.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb27.Location = new System.Drawing.Point(282, 96);
            this.cb27.Name = "cb27";
            this.cb27.Size = new System.Drawing.Size(47, 23);
            this.cb27.TabIndex = 80;
            this.cb27.Text = "customButton6";
            this.cb27.UseVisualStyleBackColor = true;
            this.cb27.Click += new System.EventHandler(this.cb27_Click);
            //
            // cb17
            //
            this.cb17.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb17.CustomDate = null;
            this.cb17.CustomDay = null;
            this.cb17.CustomMonth = null;
            this.cb17.CustomYear = null;
            this.cb17.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb17.Location = new System.Drawing.Point(282, 73);
            this.cb17.Name = "cb17";
            this.cb17.Size = new System.Drawing.Size(47, 23);
            this.cb17.TabIndex = 79;
            this.cb17.Text = "customButton6";
            this.cb17.UseVisualStyleBackColor = true;
            this.cb17.Click += new System.EventHandler(this.cb17_Click);
            //
            // cb07
            //
            this.cb07.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb07.CustomDate = null;
            this.cb07.CustomDay = null;
            this.cb07.CustomMonth = null;
            this.cb07.CustomYear = null;
            this.cb07.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb07.Location = new System.Drawing.Point(282, 50);
            this.cb07.Name = "cb07";
            this.cb07.Size = new System.Drawing.Size(47, 23);
            this.cb07.TabIndex = 78;
            this.cb07.Text = "customButton6";
            this.cb07.UseVisualStyleBackColor = true;
            this.cb07.Click += new System.EventHandler(this.cb07_Click);
            //
            // cb02
            //
            this.cb02.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb02.CustomDate = null;
            this.cb02.CustomDay = null;
            this.cb02.CustomMonth = null;
            this.cb02.CustomYear = null;
            this.cb02.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb02.Location = new System.Drawing.Point(47, 50);
            this.cb02.Name = "cb02";
            this.cb02.Size = new System.Drawing.Size(47, 23);
            this.cb02.TabIndex = 42;
            this.cb02.Text = "customButton2";
            this.cb02.UseVisualStyleBackColor = true;
            this.cb02.Click += new System.EventHandler(this.cb02_Click);
            //
            // cb01
            //
            this.cb01.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb01.CustomDate = null;
            this.cb01.CustomDay = null;
            this.cb01.CustomMonth = null;
            this.cb01.CustomYear = null;
            this.cb01.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb01.Location = new System.Drawing.Point(0, 50);
            this.cb01.Name = "cb01";
            this.cb01.Size = new System.Drawing.Size(47, 23);
            this.cb01.TabIndex = 41;
            this.cb01.Text = "customButton1";
            this.cb01.UseVisualStyleBackColor = true;
            this.cb01.Click += new System.EventHandler(this.cb01_Click);
            //
            // cb56
            //
            this.cb56.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb56.CustomDate = null;
            this.cb56.CustomDay = null;
            this.cb56.CustomMonth = null;
            this.cb56.CustomYear = null;
            this.cb56.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb56.Location = new System.Drawing.Point(235, 165);
            this.cb56.Name = "cb56";
            this.cb56.Size = new System.Drawing.Size(47, 23);
            this.cb56.TabIndex = 76;
            this.cb56.Text = "customButton31";
            this.cb56.UseVisualStyleBackColor = true;
            this.cb56.Click += new System.EventHandler(this.cb56_Click);
            //
            // cb55
            //
            this.cb55.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb55.CustomDate = null;
            this.cb55.CustomDay = null;
            this.cb55.CustomMonth = null;
            this.cb55.CustomYear = null;
            this.cb55.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb55.Location = new System.Drawing.Point(188, 165);
            this.cb55.Name = "cb55";
            this.cb55.Size = new System.Drawing.Size(47, 23);
            this.cb55.TabIndex = 75;
            this.cb55.Text = "customButton32";
            this.cb55.UseVisualStyleBackColor = true;
            this.cb55.Click += new System.EventHandler(this.cb55_Click);
            //
            // cb54
            //
            this.cb54.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb54.CustomDate = null;
            this.cb54.CustomDay = null;
            this.cb54.CustomMonth = null;
            this.cb54.CustomYear = null;
            this.cb54.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb54.Location = new System.Drawing.Point(141, 165);
            this.cb54.Name = "cb54";
            this.cb54.Size = new System.Drawing.Size(47, 23);
            this.cb54.TabIndex = 74;
            this.cb54.Text = "customButton33";
            this.cb54.UseVisualStyleBackColor = true;
            this.cb54.Click += new System.EventHandler(this.cb54_Click);
            //
            // cb53
            //
            this.cb53.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb53.CustomDate = null;
            this.cb53.CustomDay = null;
            this.cb53.CustomMonth = null;
            this.cb53.CustomYear = null;
            this.cb53.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb53.Location = new System.Drawing.Point(94, 165);
            this.cb53.Name = "cb53";
            this.cb53.Size = new System.Drawing.Size(47, 23);
            this.cb53.TabIndex = 73;
            this.cb53.Text = "customButton34";
            this.cb53.UseVisualStyleBackColor = true;
            this.cb53.Click += new System.EventHandler(this.cb53_Click);
            //
            // cb52
            //
            this.cb52.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb52.CustomDate = null;
            this.cb52.CustomDay = null;
            this.cb52.CustomMonth = null;
            this.cb52.CustomYear = null;
            this.cb52.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb52.Location = new System.Drawing.Point(47, 165);
            this.cb52.Name = "cb52";
            this.cb52.Size = new System.Drawing.Size(47, 23);
            this.cb52.TabIndex = 72;
            this.cb52.Text = "customButton35";
            this.cb52.UseVisualStyleBackColor = true;
            this.cb52.Click += new System.EventHandler(this.cb52_Click);
            //
            // cb51
            //
            this.cb51.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb51.CustomDate = null;
            this.cb51.CustomDay = null;
            this.cb51.CustomMonth = null;
            this.cb51.CustomYear = null;
            this.cb51.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb51.Location = new System.Drawing.Point(0, 165);
            this.cb51.Name = "cb51";
            this.cb51.Size = new System.Drawing.Size(47, 23);
            this.cb51.TabIndex = 71;
            this.cb51.Text = "customButton36";
            this.cb51.UseVisualStyleBackColor = true;
            this.cb51.Click += new System.EventHandler(this.cb51_Click);
            //
            // cb46
            //
            this.cb46.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb46.CustomDate = null;
            this.cb46.CustomDay = null;
            this.cb46.CustomMonth = null;
            this.cb46.CustomYear = null;
            this.cb46.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb46.Location = new System.Drawing.Point(235, 142);
            this.cb46.Name = "cb46";
            this.cb46.Size = new System.Drawing.Size(47, 23);
            this.cb46.TabIndex = 70;
            this.cb46.Text = "customButton25";
            this.cb46.UseVisualStyleBackColor = true;
            this.cb46.Click += new System.EventHandler(this.cb46_Click);
            //
            // cb45
            //
            this.cb45.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb45.CustomDate = null;
            this.cb45.CustomDay = null;
            this.cb45.CustomMonth = null;
            this.cb45.CustomYear = null;
            this.cb45.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb45.Location = new System.Drawing.Point(188, 142);
            this.cb45.Name = "cb45";
            this.cb45.Size = new System.Drawing.Size(47, 23);
            this.cb45.TabIndex = 69;
            this.cb45.Text = "customButton26";
            this.cb45.UseVisualStyleBackColor = true;
            this.cb45.Click += new System.EventHandler(this.cb45_Click);
            //
            // cb44
            //
            this.cb44.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb44.CustomDate = null;
            this.cb44.CustomDay = null;
            this.cb44.CustomMonth = null;
            this.cb44.CustomYear = null;
            this.cb44.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb44.Location = new System.Drawing.Point(141, 142);
            this.cb44.Name = "cb44";
            this.cb44.Size = new System.Drawing.Size(47, 23);
            this.cb44.TabIndex = 68;
            this.cb44.Text = "customButton27";
            this.cb44.UseVisualStyleBackColor = true;
            this.cb44.Click += new System.EventHandler(this.cb44_Click);
            //
            // cb43
            //
            this.cb43.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb43.CustomDate = null;
            this.cb43.CustomDay = null;
            this.cb43.CustomMonth = null;
            this.cb43.CustomYear = null;
            this.cb43.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb43.Location = new System.Drawing.Point(94, 142);
            this.cb43.Name = "cb43";
            this.cb43.Size = new System.Drawing.Size(47, 23);
            this.cb43.TabIndex = 67;
            this.cb43.Text = "customButton28";
            this.cb43.UseVisualStyleBackColor = true;
            this.cb43.Click += new System.EventHandler(this.cb43_Click);
            //
            // cb42
            //
            this.cb42.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb42.CustomDate = null;
            this.cb42.CustomDay = null;
            this.cb42.CustomMonth = null;
            this.cb42.CustomYear = null;
            this.cb42.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb42.Location = new System.Drawing.Point(47, 142);
            this.cb42.Name = "cb42";
            this.cb42.Size = new System.Drawing.Size(47, 23);
            this.cb42.TabIndex = 66;
            this.cb42.Text = "customButton29";
            this.cb42.UseVisualStyleBackColor = true;
            this.cb42.Click += new System.EventHandler(this.cb42_Click);
            //
            // cb41
            //
            this.cb41.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb41.CustomDate = null;
            this.cb41.CustomDay = null;
            this.cb41.CustomMonth = null;
            this.cb41.CustomYear = null;
            this.cb41.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb41.Location = new System.Drawing.Point(0, 142);
            this.cb41.Name = "cb41";
            this.cb41.Size = new System.Drawing.Size(47, 23);
            this.cb41.TabIndex = 65;
            this.cb41.Text = "customButton30";
            this.cb41.UseVisualStyleBackColor = true;
            this.cb41.Click += new System.EventHandler(this.cb41_Click);
            //
            // cb36
            //
            this.cb36.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb36.CustomDate = null;
            this.cb36.CustomDay = null;
            this.cb36.CustomMonth = null;
            this.cb36.CustomYear = null;
            this.cb36.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb36.Location = new System.Drawing.Point(235, 119);
            this.cb36.Name = "cb36";
            this.cb36.Size = new System.Drawing.Size(47, 23);
            this.cb36.TabIndex = 64;
            this.cb36.Text = "customButton19";
            this.cb36.UseVisualStyleBackColor = true;
            this.cb36.Click += new System.EventHandler(this.cb36_Click);
            //
            // cb35
            //
            this.cb35.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb35.CustomDate = null;
            this.cb35.CustomDay = null;
            this.cb35.CustomMonth = null;
            this.cb35.CustomYear = null;
            this.cb35.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb35.Location = new System.Drawing.Point(188, 119);
            this.cb35.Name = "cb35";
            this.cb35.Size = new System.Drawing.Size(47, 23);
            this.cb35.TabIndex = 63;
            this.cb35.Text = "customButton20";
            this.cb35.UseVisualStyleBackColor = true;
            this.cb35.Click += new System.EventHandler(this.cb35_Click);
            //
            // cb34
            //
            this.cb34.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb34.CustomDate = null;
            this.cb34.CustomDay = null;
            this.cb34.CustomMonth = null;
            this.cb34.CustomYear = null;
            this.cb34.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb34.Location = new System.Drawing.Point(141, 119);
            this.cb34.Name = "cb34";
            this.cb34.Size = new System.Drawing.Size(47, 23);
            this.cb34.TabIndex = 62;
            this.cb34.Text = "customButton21";
            this.cb34.UseVisualStyleBackColor = true;
            this.cb34.Click += new System.EventHandler(this.cb34_Click);
            //
            // cb33
            //
            this.cb33.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb33.CustomDate = null;
            this.cb33.CustomDay = null;
            this.cb33.CustomMonth = null;
            this.cb33.CustomYear = null;
            this.cb33.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb33.Location = new System.Drawing.Point(94, 119);
            this.cb33.Name = "cb33";
            this.cb33.Size = new System.Drawing.Size(47, 23);
            this.cb33.TabIndex = 61;
            this.cb33.Text = "customButton22";
            this.cb33.UseVisualStyleBackColor = true;
            this.cb33.Click += new System.EventHandler(this.cb33_Click);
            //
            // cb32
            //
            this.cb32.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb32.CustomDate = null;
            this.cb32.CustomDay = null;
            this.cb32.CustomMonth = null;
            this.cb32.CustomYear = null;
            this.cb32.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb32.Location = new System.Drawing.Point(47, 119);
            this.cb32.Name = "cb32";
            this.cb32.Size = new System.Drawing.Size(47, 23);
            this.cb32.TabIndex = 60;
            this.cb32.Text = "customButton23";
            this.cb32.UseVisualStyleBackColor = true;
            this.cb32.Click += new System.EventHandler(this.cb32_Click);
            //
            // cb31
            //
            this.cb31.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb31.CustomDate = null;
            this.cb31.CustomDay = null;
            this.cb31.CustomMonth = null;
            this.cb31.CustomYear = null;
            this.cb31.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb31.Location = new System.Drawing.Point(0, 119);
            this.cb31.Name = "cb31";
            this.cb31.Size = new System.Drawing.Size(47, 23);
            this.cb31.TabIndex = 59;
            this.cb31.Text = "customButton24";
            this.cb31.UseVisualStyleBackColor = true;
            this.cb31.Click += new System.EventHandler(this.cb31_Click);
            //
            // cb26
            //
            this.cb26.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb26.CustomDate = null;
            this.cb26.CustomDay = null;
            this.cb26.CustomMonth = null;
            this.cb26.CustomYear = null;
            this.cb26.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb26.Location = new System.Drawing.Point(235, 96);
            this.cb26.Name = "cb26";
            this.cb26.Size = new System.Drawing.Size(47, 23);
            this.cb26.TabIndex = 58;
            this.cb26.Text = "customButton13";
            this.cb26.UseVisualStyleBackColor = true;
            this.cb26.Click += new System.EventHandler(this.cb26_Click);
            //
            // cb25
            //
            this.cb25.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb25.CustomDate = null;
            this.cb25.CustomDay = null;
            this.cb25.CustomMonth = null;
            this.cb25.CustomYear = null;
            this.cb25.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb25.Location = new System.Drawing.Point(188, 96);
            this.cb25.Name = "cb25";
            this.cb25.Size = new System.Drawing.Size(47, 23);
            this.cb25.TabIndex = 57;
            this.cb25.Text = "customButton14";
            this.cb25.UseVisualStyleBackColor = true;
            this.cb25.Click += new System.EventHandler(this.cb25_Click);
            //
            // cb22
            //
            this.cb22.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb22.CustomDate = null;
            this.cb22.CustomDay = null;
            this.cb22.CustomMonth = null;
            this.cb22.CustomYear = null;
            this.cb22.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb22.Location = new System.Drawing.Point(47, 96);
            this.cb22.Name = "cb22";
            this.cb22.Size = new System.Drawing.Size(47, 23);
            this.cb22.TabIndex = 54;
            this.cb22.Text = "customButton17";
            this.cb22.UseVisualStyleBackColor = true;
            this.cb22.Click += new System.EventHandler(this.cb22_Click);
            //
            // cb21
            //
            this.cb21.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb21.CustomDate = null;
            this.cb21.CustomDay = null;
            this.cb21.CustomMonth = null;
            this.cb21.CustomYear = null;
            this.cb21.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb21.Location = new System.Drawing.Point(0, 96);
            this.cb21.Name = "cb21";
            this.cb21.Size = new System.Drawing.Size(47, 23);
            this.cb21.TabIndex = 53;
            this.cb21.Text = "customButton18";
            this.cb21.UseVisualStyleBackColor = true;
            this.cb21.Click += new System.EventHandler(this.cb21_Click);
            //
            // cb16
            //
            this.cb16.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb16.CustomDate = null;
            this.cb16.CustomDay = null;
            this.cb16.CustomMonth = null;
            this.cb16.CustomYear = null;
            this.cb16.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb16.Location = new System.Drawing.Point(235, 73);
            this.cb16.Name = "cb16";
            this.cb16.Size = new System.Drawing.Size(47, 23);
            this.cb16.TabIndex = 52;
            this.cb16.Text = "customButton7";
            this.cb16.UseVisualStyleBackColor = true;
            this.cb16.Click += new System.EventHandler(this.cb16_Click);
            //
            // cb15
            //
            this.cb15.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb15.CustomDate = null;
            this.cb15.CustomDay = null;
            this.cb15.CustomMonth = null;
            this.cb15.CustomYear = null;
            this.cb15.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb15.Location = new System.Drawing.Point(188, 73);
            this.cb15.Name = "cb15";
            this.cb15.Size = new System.Drawing.Size(47, 23);
            this.cb15.TabIndex = 51;
            this.cb15.Text = "customButton8";
            this.cb15.UseVisualStyleBackColor = true;
            this.cb15.Click += new System.EventHandler(this.cb15_Click);
            //
            // cb14
            //
            this.cb14.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb14.CustomDate = null;
            this.cb14.CustomDay = null;
            this.cb14.CustomMonth = null;
            this.cb14.CustomYear = null;
            this.cb14.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb14.Location = new System.Drawing.Point(141, 73);
            this.cb14.Name = "cb14";
            this.cb14.Size = new System.Drawing.Size(47, 23);
            this.cb14.TabIndex = 50;
            this.cb14.Text = "customButton9";
            this.cb14.UseVisualStyleBackColor = true;
            this.cb14.Click += new System.EventHandler(this.cb14_Click);
            //
            // cb24
            //
            this.cb24.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb24.CustomDate = null;
            this.cb24.CustomDay = null;
            this.cb24.CustomMonth = null;
            this.cb24.CustomYear = null;
            this.cb24.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb24.Location = new System.Drawing.Point(141, 96);
            this.cb24.Name = "cb24";
            this.cb24.Size = new System.Drawing.Size(47, 23);
            this.cb24.TabIndex = 56;
            this.cb24.Text = "customButton15";
            this.cb24.UseVisualStyleBackColor = true;
            this.cb24.Click += new System.EventHandler(this.cb24_Click);
            //
            // cb23
            //
            this.cb23.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb23.CustomDate = null;
            this.cb23.CustomDay = null;
            this.cb23.CustomMonth = null;
            this.cb23.CustomYear = null;
            this.cb23.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb23.Location = new System.Drawing.Point(94, 96);
            this.cb23.Name = "cb23";
            this.cb23.Size = new System.Drawing.Size(47, 23);
            this.cb23.TabIndex = 55;
            this.cb23.Text = "customButton16";
            this.cb23.UseVisualStyleBackColor = true;
            this.cb23.Click += new System.EventHandler(this.cb23_Click);
            //
            // cb13
            //
            this.cb13.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb13.CustomDate = null;
            this.cb13.CustomDay = null;
            this.cb13.CustomMonth = null;
            this.cb13.CustomYear = null;
            this.cb13.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb13.Location = new System.Drawing.Point(94, 73);
            this.cb13.Name = "cb13";
            this.cb13.Size = new System.Drawing.Size(47, 23);
            this.cb13.TabIndex = 49;
            this.cb13.Text = "customButton10";
            this.cb13.UseVisualStyleBackColor = true;
            this.cb13.Click += new System.EventHandler(this.cb13_Click);
            //
            // cb12
            //
            this.cb12.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb12.CustomDate = null;
            this.cb12.CustomDay = null;
            this.cb12.CustomMonth = null;
            this.cb12.CustomYear = null;
            this.cb12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb12.Location = new System.Drawing.Point(47, 73);
            this.cb12.Name = "cb12";
            this.cb12.Size = new System.Drawing.Size(47, 23);
            this.cb12.TabIndex = 48;
            this.cb12.Text = "customButton11";
            this.cb12.UseVisualStyleBackColor = true;
            this.cb12.Click += new System.EventHandler(this.cb12_Click);
            //
            // cb11
            //
            this.cb11.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb11.CustomDate = null;
            this.cb11.CustomDay = null;
            this.cb11.CustomMonth = null;
            this.cb11.CustomYear = null;
            this.cb11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb11.Location = new System.Drawing.Point(0, 73);
            this.cb11.Name = "cb11";
            this.cb11.Size = new System.Drawing.Size(47, 23);
            this.cb11.TabIndex = 47;
            this.cb11.Text = "customButton12";
            this.cb11.UseVisualStyleBackColor = true;
            this.cb11.Click += new System.EventHandler(this.cb11_Click);
            //
            // cb06
            //
            this.cb06.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb06.CustomDate = null;
            this.cb06.CustomDay = null;
            this.cb06.CustomMonth = null;
            this.cb06.CustomYear = null;
            this.cb06.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb06.Location = new System.Drawing.Point(235, 50);
            this.cb06.Name = "cb06";
            this.cb06.Size = new System.Drawing.Size(47, 23);
            this.cb06.TabIndex = 46;
            this.cb06.Text = "customButton6";
            this.cb06.UseVisualStyleBackColor = true;
            this.cb06.Click += new System.EventHandler(this.cb06_Click);
            //
            // cb05
            //
            this.cb05.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb05.CustomDate = null;
            this.cb05.CustomDay = null;
            this.cb05.CustomMonth = null;
            this.cb05.CustomYear = null;
            this.cb05.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb05.Location = new System.Drawing.Point(188, 50);
            this.cb05.Name = "cb05";
            this.cb05.Size = new System.Drawing.Size(47, 23);
            this.cb05.TabIndex = 45;
            this.cb05.Text = "customButton5";
            this.cb05.UseVisualStyleBackColor = true;
            this.cb05.Click += new System.EventHandler(this.cb05_Click);
            //
            // cb04
            //
            this.cb04.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb04.CustomDate = null;
            this.cb04.CustomDay = null;
            this.cb04.CustomMonth = null;
            this.cb04.CustomYear = null;
            this.cb04.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb04.Location = new System.Drawing.Point(141, 50);
            this.cb04.Name = "cb04";
            this.cb04.Size = new System.Drawing.Size(47, 23);
            this.cb04.TabIndex = 44;
            this.cb04.Text = "customButton4";
            this.cb04.UseVisualStyleBackColor = true;
            this.cb04.Click += new System.EventHandler(this.cb04_Click);
            //
            // cb03
            //
            this.cb03.Cursor = System.Windows.Forms.Cursors.Default;
            this.cb03.CustomDate = null;
            this.cb03.CustomDay = null;
            this.cb03.CustomMonth = null;
            this.cb03.CustomYear = null;
            this.cb03.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.cb03.Location = new System.Drawing.Point(94, 50);
            this.cb03.Name = "cb03";
            this.cb03.Size = new System.Drawing.Size(47, 23);
            this.cb03.TabIndex = 43;
            this.cb03.Text = "customButton3";
            this.cb03.UseVisualStyleBackColor = true;
            this.cb03.Click += new System.EventHandler(this.cb03_Click);
            //
            // UCCustomCalendar
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.Controls.Add(this.lblCurrendDate);
            this.Controls.Add(this.cb57);
            this.Controls.Add(this.cb47);
            this.Controls.Add(this.cb37);
            this.Controls.Add(this.cb27);
            this.Controls.Add(this.cb17);
            this.Controls.Add(this.cb07);
            this.Controls.Add(this.cb02);
            this.Controls.Add(this.cb01);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cb56);
            this.Controls.Add(this.cb55);
            this.Controls.Add(this.cb54);
            this.Controls.Add(this.cb53);
            this.Controls.Add(this.cb52);
            this.Controls.Add(this.cb51);
            this.Controls.Add(this.cb46);
            this.Controls.Add(this.cb45);
            this.Controls.Add(this.cb44);
            this.Controls.Add(this.cb43);
            this.Controls.Add(this.cb42);
            this.Controls.Add(this.cb41);
            this.Controls.Add(this.cb36);
            this.Controls.Add(this.cb35);
            this.Controls.Add(this.cb34);
            this.Controls.Add(this.cb33);
            this.Controls.Add(this.cb32);
            this.Controls.Add(this.cb31);
            this.Controls.Add(this.cb26);
            this.Controls.Add(this.cb25);
            this.Controls.Add(this.cb22);
            this.Controls.Add(this.cb21);
            this.Controls.Add(this.cb16);
            this.Controls.Add(this.cb15);
            this.Controls.Add(this.cb14);
            this.Controls.Add(this.cb24);
            this.Controls.Add(this.cb23);
            this.Controls.Add(this.cb13);
            this.Controls.Add(this.cb12);
            this.Controls.Add(this.cb11);
            this.Controls.Add(this.cb06);
            this.Controls.Add(this.cb05);
            this.Controls.Add(this.cb04);
            this.Controls.Add(this.cb03);
            this.Controls.Add(this.panelWeek);
            this.Controls.Add(this.panel1);
            this.Cursor = System.Windows.Forms.Cursors.Default;
            this.Name = "UCCustomCalendar";
            this.Size = new System.Drawing.Size(330, 212);
            this.Load += new System.EventHandler(this.UCCustomCalendar_Load);
            this.SizeChanged += new System.EventHandler(this.UCCustomCalendar_SizeChanged);
            this.panelWeek.ResumeLayout(false);
            this.panelWeek.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.YearUD)).EndInit();
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private CustomButton cb56;
        private CustomButton cb55;
        private CustomButton cb54;
        private CustomButton cb53;
        private CustomButton cb52;
        private CustomButton cb51;
        private CustomButton cb46;
        private CustomButton cb45;
        private CustomButton cb44;
        private CustomButton cb43;
        private CustomButton cb42;
        private CustomButton cb41;
        private CustomButton cb36;
        private CustomButton cb35;
        private CustomButton cb34;
        private CustomButton cb33;
        private CustomButton cb32;
        private CustomButton cb31;
        private CustomButton cb26;
        private CustomButton cb25;
        private CustomButton cb22;
        private CustomButton cb21;
        private CustomButton cb16;
        private CustomButton cb15;
        private CustomButton cb14;
        private System.Windows.Forms.Label lblWed;
        private System.Windows.Forms.Label lblTues;
        private System.Windows.Forms.Label lblMon;
        private CustomButton cb24;
        private System.Windows.Forms.Label lblThurs;
        private CustomButton cb23;
        private CustomButton cb13;
        private CustomButton cb12;
        private System.Windows.Forms.Button cmdNext;
        private CustomButton cb11;
        private CustomButton cb06;
        private System.Windows.Forms.Button cmdPrevious;
        private CustomButton cb05;
        private CustomButton cb04;
        private CustomButton cb03;
        private System.Windows.Forms.Panel panelWeek;
        private System.Windows.Forms.Label lblSat;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Label lblFriday;
        private CustomButton cb02;
        private CustomButton cb01;
        private System.Windows.Forms.Label label2;
        private CustomButton cb07;
        private CustomButton cb17;
        private CustomButton cb27;
        private CustomButton cb37;
        private CustomButton cb47;
        private CustomButton cb57;
        private System.Windows.Forms.Label lblCurrendDate;
        private System.Windows.Forms.TextBox txtCurrDate;
        private System.Windows.Forms.TextBox txtMonth;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.NumericUpDown YearUD;
    }
}

3)算法及事件文件

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

namespace Custom
{
    public partial class UCCustomCalendar : UserControl
    {
        //Custom Date,Year,Month and Day
        private String customDate;
        private String customYear;
        private String customMonth;
        private String customDay;
       
        private int minLayer = 1;
        private int middleLayer;
        private int sumDay;

        [Browsable(true), Category("赻隅砱剒杅擂"), Description("隅秶ㄛ硉峈趼睫倰ㄛ跡宒峈YYYY-MM-DD")]
        public String CustomDate
        {
            set { customDate = value; }
            get { return customDate; }
        }

        [Browsable(true), Category("赻隅砱剒杅擂"), Description("隅秶爛ㄛ硉峈趼睫倰ㄛ跡宒峈YYYY")]
        public String CustomYear
        {
            set { customYear = value; }
            get { return customYear; }
        }

        [Browsable(true), Category("赻隅砱剒杅擂"), Description("隅秶堎ㄛ硉峈趼睫倰ㄛ跡宒峈MM")]
        public String CustomMonth
        {
            set { customMonth = value; }
            get { return customMonth; }
        }

        [Browsable(true), Category("赻隅砱剒杅擂"), Description("隅秶ㄛ硉峈趼睫倰ㄛ跡宒峈DD")]
        public String CustomDay
        {
            set { customDay = value; }
            get { return customDay; }
        }

        public UCCustomCalendar()
        {
            InitializeComponent();
            customDate = DateTime.Today.ToString("yyyy-MM-dd");
            lblCurrendDate.Text = DateTime.Today.ToString("yyyy爛MM堎dd");
            customMonth = DateTime.Parse(customDate).ToString("MM");
            customYear = DateTime.Parse(customDate).ToString("yyyy");
            customDay = DateTime.Parse(customDate).ToString("dd");
            txtCurrDate.Text = DateTime.Parse(customDate).ToString("yyyy");
            txtMonth.Text = customMonth;
            DrawButtons(customDate);
            ControlContextMenuStrip();
            LoadMonths();
            YearUD.Visible = false;
           
        }

        private void UCCustomCalendar_Load(object sender, EventArgs e)
        {

        }
        private void UCCustomCalendar_SizeChanged(object sender, EventArgs e)
        {
            this.Width = 330;
            this.Height = 212;
        }
        //奻堎呁豻毞杅
        private int GetLastMonthDays(DateTime CurrDate)
        {
            int lastMonthBalDays = 0;
            switch (CurrDate.DayOfWeek)
            {
                case DayOfWeek.Sunday:
                    lastMonthBalDays = 0;
                    break;
                case DayOfWeek.Monday:
                    lastMonthBalDays = 1;
                    break;
                case DayOfWeek.Tuesday:
                    lastMonthBalDays = 2;
                    break;
                case DayOfWeek.Wednesday:
                    lastMonthBalDays = 3;
                    break;
                case DayOfWeek.Thursday:
                    lastMonthBalDays = 4;
                    break;
                case DayOfWeek.Friday:
                    lastMonthBalDays = 5;
                    break;
                case DayOfWeek.Saturday:
                    lastMonthBalDays = 6;
                    break;
            }
            return lastMonthBalDays;
        }
        //扢离偌聽欴宒
        private void SetButtonFlatStyle(CustomButton btn)
        {
            //if (btn.BackColor == Color.White)
            if (btn.BackColor == Color.Green)
            {
                btn.BackColor = Color.Red;
                //btn.BackColor =System.Drawing.SystemColors.
            }
            else
            {
                btn.BackColor = Color.Green;
            }
        }

        private void AddLastSurplusDates(String strCurrDate)
        {
            String strLastDate_Temp;
            String buttonYMName;
            //絞
            DateTime CurrDate = DateTime.Parse(strCurrDate);
            //奻堎郔綴珨毞
            DateTime endDate = CurrDate.Date.AddDays(-CurrDate.Date.Day);
            int lastBalDays = GetLastMonthDays(endDate);
            sumDay = lastBalDays;
            if (lastBalDays == 7)
                middleLayer = minLayer + 1;
            else
                middleLayer = minLayer;
            buttonYMName = endDate.ToString("yyyyMM");
            strLastDate_Temp = endDate.ToString("yyyy-MM");
            DateTime LastDate;

            for (int i = lastBalDays; i >= 0; i--)
            {
                LastDate = endDate.AddDays(-i);
                switch (LastDate.DayOfWeek)
                {
                    case DayOfWeek.Monday:
                        AddNameAndText(cb02,  LastDate, i, 2, strLastDate_Temp, DayOfWeek.Monday);
                        break;
                    case DayOfWeek.Tuesday:
                        AddNameAndText(cb03,LastDate, i, 3, strLastDate_Temp, DayOfWeek.Tuesday);
                        break;
                    case DayOfWeek.Wednesday:
                        AddNameAndText(cb04, LastDate, i, 4, strLastDate_Temp, DayOfWeek.Wednesday);
                        break;
                    case DayOfWeek.Thursday:
                        AddNameAndText(cb05, LastDate, i, 5, strLastDate_Temp, DayOfWeek.Thursday);
                        break;
                    case DayOfWeek.Friday:
                        AddNameAndText(cb06, LastDate, i, 6, strLastDate_Temp, DayOfWeek.Friday);
                        break;
                    case DayOfWeek.Saturday:
                        AddNameAndText(cb07, LastDate, i, 7, strLastDate_Temp, DayOfWeek.Saturday);
                        //layer = layer + 1;
                        middleLayer = minLayer + 1;
                        break;
                    case DayOfWeek.Sunday:
                        AddNameAndText(cb01, LastDate, i, 1, strLastDate_Temp, DayOfWeek.Sunday);
                        break;
                }
            }
        }


        //扢离偌聽靡備摯囀
        private void AddNameAndText(CustomButton btn, DateTime LastDate, int i, int position, String strLastDate_Temp, DayOfWeek dow)
        {
           
            String btnText, strLastDate;
           
            btnText = LastDate.Date.Day.ToString();
            strLastDate = strLastDate_Temp + GetDate(LastDate.Date.Day);

            GetButton(btn,minLayer,  btnText, strLastDate);

            if (dow == DayOfWeek.Sunday || dow == DayOfWeek.Saturday)
                btn.BackColor = Color.Red;
        }

        private void GetButton(CustomButton btn ,int layer, String text, String strDate)
        {
            btn.Text = text;
            btn.CustomDate = strDate;
            btn.CustomYear = DateTime.Parse(strDate).ToString("yyyy");
            btn.CustomMonth = DateTime.Parse(strDate).ToString("MM");
            btn.BackColor = Color.Green;
        }
        private void Button_Click(object sender, EventArgs e)
        {
            //CustomButton btn =(bu)
            SetButtonFlatStyle((CustomButton)sender);
        }
        //腕掛堎
        private void AddCurrentDates(String StrCurrDate)
        {
            int layer;
            int her = 0;
            int temp = 0;
            int lastdate = 0;
            layer = middleLayer;
            String btnText;
            String strDate;
            String strDate_Temp;
            DateTime beginDate;//絞堎腔菴珨瘍

            DateTime CurrDate = DateTime.Parse(StrCurrDate);

            int beginDays = CurrDate.Date.AddDays(-CurrDate.Date.Day + 1).Day;
            int endDays = (CurrDate.Date.AddDays(-CurrDate.Date.Day + 1).AddMonths(1)).AddDays(-1).Day;
            beginDate = CurrDate.Date.AddDays(-CurrDate.Date.Day);
            strDate_Temp = CurrDate.Date.ToString("yyyy-MM");
           
            int currDays = GetCurrentDays(CurrDate);
            DateTime nextDate = beginDate.AddMonths(1);

            sumDay = sumDay + endDays;
            //餅秶奻跺堎呁豻毞杅
            //餅秶
            for (int i = beginDays; i <= endDays; i++)
            {
                if (layer > temp)
                {
                    her = 0;
                }
                else
                {
                    her = her + 1;
                }
                switch (beginDate.AddDays(i).DayOfWeek)
                {
                    case DayOfWeek.Monday:
                        btnText = i.ToString() ;
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb02, layer,  btnText, strDate);
                                break;
                            case 2:
                                GetButton(cb12, layer,  btnText, strDate);

                                break;
                            case 3:
                                GetButton(cb22, layer,  btnText, strDate);

                                break;
                            case 4:
                                GetButton(cb32, layer,  btnText, strDate);
                                break;
                            case 5:
                                GetButton(cb42, layer,  btnText, strDate);
                                break;
                            case 6:
                                GetButton(cb52, layer,  btnText, strDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Tuesday:
                        btnText = i.ToString();
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb03, layer,  btnText, strDate);
                                break;
                            case 2:
                                GetButton(cb13, layer,  btnText, strDate);
                                break;
                            case 3:
                                GetButton(cb23, layer, btnText, strDate);
                                break;
                            case 4:
                                GetButton(cb33, layer,  btnText, strDate);
                                break;
                            case 5:
                                GetButton(cb43, layer, btnText, strDate);
                                break;
                            case 6:
                                GetButton(cb53, layer,  btnText, strDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Wednesday:
                        btnText = i.ToString();
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb04, layer,  btnText, strDate);
                                break;
                            case 2:
                                GetButton(cb14, layer, btnText, strDate);
                                break;
                            case 3:
                                GetButton(cb24, layer, btnText, strDate);
                                break;
                            case 4:
                                GetButton(cb34, layer,  btnText, strDate);
                                break;
                            case 5:
                                GetButton(cb44, layer,  btnText, strDate);
                                break;
                            case 6:
                                GetButton(cb54, layer,  btnText, strDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Thursday:
                        btnText = i.ToString();
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb05, layer,  btnText, strDate);
                                break;
                            case 2:
                                GetButton(cb15, layer, btnText, strDate);
                                break;
                            case 3:
                                GetButton(cb25, layer,  btnText, strDate);
                                break;
                            case 4:
                                GetButton(cb35, layer,  btnText, strDate);
                                break;
                            case 5:
                                GetButton(cb45, layer,  btnText, strDate);
                                break;
                            case 6:
                                GetButton(cb55, layer,  btnText, strDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Friday:
                        btnText = i.ToString();
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb06, layer,  btnText, strDate);
                                break;
                            case 2:
                                GetButton(cb16, layer,  btnText, strDate);
                                break;
                            case 3:
                                GetButton(cb26, layer, btnText, strDate);
                                break;
                            case 4:
                                GetButton(cb36, layer, btnText, strDate);
                                break;
                            case 5:
                                GetButton(cb46, layer, btnText, strDate);
                                break;
                            case 6:
                                GetButton(cb56, layer,  btnText, strDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Saturday:
                        btnText = i.ToString() ;
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb07, layer,  btnText, strDate);
                                cb07.BackColor = Color.Red;
                                break;
                            case 2:
                                GetButton(cb17, layer, btnText, strDate);
                                cb17.BackColor = Color.Red;
                                break;
                            case 3:
                                GetButton(cb27, layer, btnText, strDate);
                                cb27.BackColor = Color.Red;
                                break;
                            case 4:
                                GetButton(cb37, layer, btnText, strDate);
                                cb37.BackColor = Color.Red;
                                break;
                            case 5:
                                GetButton(cb47, layer, btnText, strDate);
                                cb47.BackColor = Color.Red;
                                break;
                            case 6:
                                GetButton(cb57, layer, btnText, strDate);
                                cb57.BackColor = Color.Red;
                                break;
                        }
                        layer = layer + 1;
                        break;
                    case DayOfWeek.Sunday:
                        btnText = i.ToString();
                        lastdate = i;
                        strDate = strDate_Temp + GetDate(i);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb01, layer, btnText, strDate);
                                cb01.BackColor = Color.Red;
                                break;
                            case 2:
                                GetButton(cb11, layer, btnText, strDate);
                                cb11.BackColor = Color.Red;
                                break;
                            case 3:
                                GetButton(cb21, layer,  btnText, strDate);
                                cb21.BackColor = Color.Red;
                                break;
                            case 4:
                                GetButton(cb31, layer,  btnText, strDate);
                                cb31.BackColor = Color.Red;
                                break;
                            case 5:
                                GetButton(cb41, layer,  btnText, strDate);
                                cb41.BackColor = Color.Red;
                                break;
                            case 6:
                                GetButton(cb51, layer,  btnText, strDate);
                                cb51.BackColor = Color.Red;
                                break;
                        }
                        break;
                }

                if (nextDate.DayOfWeek == DayOfWeek.Saturday && i < endDays)
                    middleLayer = layer + 1;
                else
                    middleLayer = layer;
            }
            sumDay = 42 - sumDay - 1;
        }

        //偌聽恅掛窒煦
        private String GetDate(int i)
        {
            if (i < 10)
                return "-0" + i.ToString().Trim();
            else
                return "-" + i.ToString().Trim();
        }

        private void AddNextDates(String StrCurrDate)
        {
            int layer = 1;
            String btnText;
            layer = middleLayer;
            DateTime CurrDate = DateTime.Parse(StrCurrDate);
            DateTime CurrOneDate = CurrDate.Date.AddDays(-CurrDate.Date.Day + 1);

            //謗堎郔綴珨毞
            DateTime beginDate = CurrOneDate.AddMonths(1);
            //掛堎郔綴珨毞
            DateTime nextDate = beginDate.AddDays(-1);
            String strLastDate_Temp;
            String strLastDate;

            strLastDate_Temp = beginDate.ToString("yyyy-MM");


            for (int i = 1; i <= sumDay; i++)
            {
                switch (nextDate.AddDays(i).DayOfWeek)
                {
                    case DayOfWeek.Monday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb02, layer, btnText, strLastDate);
                                break;
                            case 2:
                                GetButton(cb12, layer, btnText, strLastDate);
                                break;
                            case 3:
                                GetButton(cb22, layer, btnText, strLastDate);
                                break;
                            case 4:
                                GetButton(cb32, layer, btnText, strLastDate);
                                break;
                            case 5:
                                GetButton(cb42, layer, btnText, strLastDate);
                                break;
                            case 6:
                                GetButton(cb52, layer, btnText, strLastDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Tuesday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb03, layer, btnText, strLastDate);
                                break;
                            case 2:
                                GetButton(cb13, layer, btnText, strLastDate);
                                break;
                            case 3:
                                GetButton(cb23, layer, btnText, strLastDate);
                                break;
                            case 4:
                                GetButton(cb33, layer, btnText, strLastDate);
                                break;
                            case 5:
                                GetButton(cb43, layer, btnText, strLastDate);
                                break;
                            case 6:
                                GetButton(cb53, layer, btnText, strLastDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Wednesday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb04, layer, btnText, strLastDate);
                                break;
                            case 2:
                                GetButton(cb14, layer, btnText, strLastDate);
                                break;
                            case 3:
                                GetButton(cb24, layer, btnText, strLastDate);
                                break;
                            case 4:
                                GetButton(cb34, layer, btnText, strLastDate);
                                break;
                            case 5:
                                GetButton(cb44, layer, btnText, strLastDate);
                                break;
                            case 6:
                                GetButton(cb54, layer, btnText, strLastDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Thursday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb05, layer, btnText, strLastDate);
                                break;
                            case 2:
                                GetButton(cb15, layer, btnText, strLastDate);
                                break;
                            case 3:
                                GetButton(cb25, layer, btnText, strLastDate);
                                break;
                            case 4:
                                GetButton(cb35, layer, btnText, strLastDate);
                                break;
                            case 5:
                                GetButton(cb45, layer, btnText, strLastDate);
                                break;
                            case 6:
                                GetButton(cb55, layer, btnText, strLastDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Friday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb06, layer, btnText, strLastDate);
                                break;
                            case 2:
                                GetButton(cb16, layer, btnText, strLastDate);
                                break;
                            case 3:
                                GetButton(cb26, layer, btnText, strLastDate);
                                break;
                            case 4:
                                GetButton(cb36, layer, btnText, strLastDate);
                                break;
                            case 5:
                                GetButton(cb46, layer, btnText, strLastDate);
                                break;
                            case 6:
                                GetButton(cb56, layer, btnText, strLastDate);
                                break;
                        }
                        break;
                    case DayOfWeek.Saturday:
                        btnText = nextDate.AddDays(i).Day.ToString();
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);

                        switch (layer)
                        {
                            case 1:
                                GetButton(cb07, layer, btnText, strLastDate);
                                cb07.BackColor = Color.Red;
                                break;
                            case 2:
                                GetButton(cb17, layer, btnText, strLastDate);
                                cb17.BackColor = Color.Red;
                                break;
                            case 3:
                                GetButton(cb27, layer, btnText, strLastDate);
                                cb27.BackColor = Color.Red;
                                break;
                            case 4:
                                GetButton(cb37, layer, btnText, strLastDate);
                                cb37.BackColor = Color.Red;
                                break;
                            case 5:
                                GetButton(cb47, layer, btnText, strLastDate);
                                cb47.BackColor = Color.Red;
                                break;
                            case 6:
                                GetButton(cb57, layer, btnText, strLastDate);
                                cb57.BackColor = Color.Red;
                                break;
                        }

                        layer = layer + 1;
                        break;
                    case DayOfWeek.Sunday:
                        btnText = nextDate.AddDays(i).Day.ToString() ;
                        strLastDate = strLastDate_Temp + GetDate(nextDate.AddDays(i).Day);
                        switch (layer)
                        {
                            case 1:
                                GetButton(cb01, layer, btnText, strLastDate);
                                cb01.BackColor = Color.Red;
                                break;
                            case 2:
                                GetButton(cb11, layer, btnText, strLastDate);
                                cb11.BackColor = Color.Red;
                                break;
                            case 3:
                                GetButton(cb21, layer, btnText, strLastDate);
                                cb21.BackColor = Color.Red;
                                break;
                            case 4:
                                GetButton(cb31, layer, btnText, strLastDate);
                                cb31.BackColor = Color.Red;
                                break;
                            case 5:
                                GetButton(cb41, layer, btnText, strLastDate);
                                cb41.BackColor = Color.Red;
                                break;
                            case 6:
                                GetButton(cb51, layer, btnText, strLastDate);
                                cb51.BackColor = Color.Red;
                                break;
                        }
                        break;
                }
            }

        }
        //奻堎呁豻毞杅
        private int GetCurrentDays(DateTime CurrDate)
        {
            int days = CurrDate.Date.AddDays(CurrDate.Date.Day).Day;
            days = CurrDate.Date.AddDays(-days).AddMonths(1).Day;
            return days;
        }

        private void DrawButtons(String strCurrentDate)
        {
            middleLayer = 1;
            sumDay = 0;
            AddLastSurplusDates(strCurrentDate);
            AddCurrentDates(strCurrentDate);
            AddNextDates(strCurrentDate);

        }

        private void cmdNext_Click(object sender, EventArgs e)
        {
            customDate = txtCurrDate.Text.Trim() + "爛" + txtMonth.Text.Trim() + "堎";
            customDate = customDate + "01";
            customDate = DateTime.Parse(customDate).AddMonths(1).ToString("yyyy爛MM堎dd");
            txtCurrDate.Text = DateTime.Parse(customDate).ToString("yyyy"); ;
            txtMonth.Text = DateTime.Parse(customDate).ToString("MM"); ;
            customDate = DateTime.Parse(customDate).ToString("yyyy-MM-dd");
            DrawButtons(customDate);
        }

        private void cmdPrevious_Click(object sender, EventArgs e)
        {
            customDate = txtCurrDate.Text.Trim() + "爛" + txtMonth.Text.Trim() + "堎";
            customDate = customDate + "01";
            customDate = DateTime.Parse(customDate).AddMonths(-1).ToString("yyyy爛MM堎dd");
            txtCurrDate.Text = DateTime.Parse(customDate).ToString("yyyy"); ;
            txtMonth.Text = DateTime.Parse(customDate).ToString("MM"); ;
            customDate = DateTime.Parse(customDate).ToString("yyyy-MM-dd");
            DrawButtons(customDate);
        }

        private void txtCurrDate_GotFocus(object sender, EventArgs e)
        {
            YearUD.Value = int.Parse(txtCurrDate.Text);
            YearUD.Top = YearUD.Top;
            YearUD.Left = txtCurrDate.Left + txtCurrDate.Width;
            YearUD.Visible = true;
            txtCurrDate.BackColor = Color.Gray;
            txtCurrDate.ForeColor = Color.Black;
        }

        private void txtCurrDate_LostFocus(object sender, EventArgs e)
        {
            txtCurrDate.Text = YearUD.Value.ToString();
            YearUD.Top = YearUD.Top;
            YearUD.Left = txtCurrDate.Left + txtCurrDate.Width;
            YearUD.Visible = false;
            txtCurrDate.BackColor = Color.Navy;
            txtCurrDate.ForeColor = Color.White;
        }

        private void YearUD_ValueChanged(object sender, EventArgs e)
        {
            txtCurrDate.Text = YearUD.Value.ToString();
            customDate = txtCurrDate.Text.Trim() + "爛" + txtMonth.Text.Trim() + "堎";
            customDate = customDate + "01";
            YearUD.Visible = true;
            DrawButtons(customDate);
        }

        private void LoadMonths()
        {
            ContextMenuStrip cmsMonth = new ContextMenuStrip();
            ToolStripMenuItem menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem,"mnuJAN", "珨堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuFEB", "媼堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuMAR", "堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuAPR", "侐堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuMAY", "拻堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuJUN", "鞠堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuJUL", "堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuAUG", "匐堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuSEP", "嬝堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuOCT", "坋堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuNOV", "坋珨堎");
            cmsMonth.Items.Add(menuItem);

            menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuDEC", "坋媼堎");
            cmsMonth.Items.Add(menuItem);

            txtMonth.ContextMenuStrip = cmsMonth;
        }

        private void AddMenuItems(ToolStripMenuItem menuItem,String name, String text)
        {
            menuItem.Name = name;
            menuItem.Text = text;
            menuItem.Click += new EventHandler(MenuItem_Click);
        }

        private void MenuItem_Click(object sender, EventArgs e)
        {
            switch (((ToolStripMenuItem)sender).Name)
            {
                case "mnuJAN":
                    txtMonth.Text = "01";
                    break;
                case "mnuFEB":
                    txtMonth.Text = "02";
                    break;
                case "mnuMAR":
                    txtMonth.Text = "03";
                    break;
                case "mnuAPR":
                    txtMonth.Text = "04";
                    break;
                case "mnuMAY":
                    txtMonth.Text = "05";
                    break;
                case "mnuJUN":
                    txtMonth.Text = "06";
                    break;
                case "mnuJUL":
                    txtMonth.Text = "07";
                    break;
                case "mnuAUG":
                    txtMonth.Text = "08";
                    break;
                case "mnuSEP":
                    txtMonth.Text = "09";
                    break;
                case "mnuOCT":
                    txtMonth.Text = "10";
                    break;
                case "mnuNOV":
                    txtMonth.Text = "11";
                    break;
                case "mnuDEC":
                    txtMonth.Text = "12";
                    break;
            }
            customDate = txtCurrDate.Text.Trim() + "爛" + txtMonth.Text.Trim() + "堎";
            customDate = customDate + "01";
            DrawButtons(customDate);
        }

        private void ControlContextMenuStrip()
        {
            ContextMenuStrip cmsToDay = new ContextMenuStrip();
            ToolStripMenuItem menuItem = new ToolStripMenuItem();
            AddMenuItems(menuItem, "mnuToDay", "蛌善踏毞(&G)");
            menuItem.Click += new EventHandler(mnuToDay_Click);
            cmsToDay.Items.Add(menuItem);
            this.ContextMenuStrip = cmsToDay;
        }

        private void mnuToDay_Click(object sender, EventArgs e)
        {
            String strYMD = DateTime.Today.ToString("yyyy爛MM堎dd");
            txtCurrDate.Text = DateTime.Today.ToString("yyyy");
            txtMonth.Text = DateTime.Today.ToString("MM");
            DrawButtons(strYMD);
        }
        public ArrayList GetDates()
        {
            ArrayList al = new ArrayList();
            CustomButton cb;
            foreach (Control ctl in this.Controls)
            {
                if (ctl is CustomButton)
                {
                    if (ctl.BackColor == Color.Green)
                    {
                        cb = (CustomButton)ctl;
                        al.Add(cb.CustomDate);
                    }
                }
            }
            return al;
        }

        private void YearUD_LostFocus(object sender, EventArgs e)
        {
            YearUD.Visible = false;
        }
        //偌聽萸僻岈璃
        private void cb57_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb47_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb37_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb27_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb17_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb07_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        //菴鞠蹈
        private void cb56_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb46_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb36_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb26_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb16_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb06_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }

        //菴拻蹈
        private void cb55_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb45_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb35_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb25_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb15_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb05_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }

        //菴侐蹈
        private void cb54_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb44_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb34_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb24_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb14_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb04_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        //菴蹈
        private void cb53_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb43_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb33_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb23_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb13_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb03_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }

        //菴媼蹈
        private void cb52_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb42_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb32_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb22_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb12_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb02_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }

        //菴珨蹈
        private void cb51_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb41_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb31_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb21_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb11_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
        private void cb01_Click(object sender, EventArgs e)
        {
            SetButtonFlatStyle((CustomButton)sender);
        }
    }
}


註:

1)上面的版本是WinForm。

2)Web版的已經完成.

特別聲明:

這些組件都是個人在家開發,而非公司版權。任何人使用,需要得本人許可,否則視非法。

 

 

 

原创粉丝点击