日期:2012-02-17  浏览次数:20446 次

using System;

using System.Collections;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Windows.Forms;



namespace XPangLib

{

/// <summary>

/// DateInput 的摘要说明。

/// </summary>

public class DateInput : System.Windows.Forms.UserControl

{

#region 成员控件



private System.Windows.Forms.MonthCalendar Calendar ;

private System.Windows.Forms.Form frmCalendar ;

private System.Windows.Forms.Panel panel3;

private System.Windows.Forms.Button btnMain;

private System.Windows.Forms.VScrollBar UpDown;

private System.Windows.Forms.Panel panel1;

private System.Windows.Forms.Panel panel2;

private System.Windows.Forms.Label lbSep3;

private System.Windows.Forms.TextBox tbDay;

private System.Windows.Forms.Label lbSep2;

private System.Windows.Forms.TextBox tbMonth;

private System.Windows.Forms.Label lbSep1;

private System.Windows.Forms.TextBox tbYear;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label lbSpace;

#endregion



/// <summary>

/// 必需的设计器变量。

/// </summary>

private System.ComponentModel.Container components = null;



private ContextMenu mnu = new ContextMenu() ;



#region 自定义属性

[Browsable(true),ReadOnly(false)]

public Size Size

{

set

{

base.Size = new Size(value.Width,21) ;

this.SetBounds(base.Location.X,base.Location.Y,this.Width,base.Height) ;

this.Refresh() ;

}

get

{

return base.Size ;

}

}



private string strDateFormat ;

[CategoryAttribute("显示属性和值"),

TypeConverterAttribute(typeof(DateFormatConverter)),

DescriptionAttribute("时间显示格式"),

ReadOnlyAttribute(false)]

public string DateFormat

{

get

{

return strDateFormat ;

}

set

{

strDateFormat = value ;

RefreshDisplay() ;

}

}





private string strFomatChar ;

[CategoryAttribute("显示属性和值"),

DescriptionAttribute("自定义显示格式"),

ReadOnlyAttribute(false)]

public string FomatChar

{

get

{

return strFomatChar ;

}

set

{

strFomatChar = value ;

RefreshDisplay() ;

}

}





bool blShowUpDown = false ;



[CategoryAttribute("显示属性和值"),

DescriptionAttribute("显示UpDown按钮"),

ReadOnlyAttribute(false)]