首页|操作系统|软件开发|网页制作|媒体动画|数据库|ASP教程|ASP.NET教程|PHP教程|JSP教程|XML教程|建站资料|软件学院|行业资讯|平面设计|网络安全|晒IT论坛|IT人才
  位置: 晒IT >> ASP.NET教程 >> Asp.Net实例教程 >> 正文
 
 
可用来显示空值的时间选择控件2
可用来显示空值的时间选择控件2
 
 
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)]

public bool ShowUpDown

{

get

{

return blShowUpDown ;

}

set

{

blShowUpDown = value ;

this.btnMain.Visible = !value ;

this.UpDown.Visible = value ;

}

}





private DateTime dtValue ;

/// <summary>

/// 选定的日期

/// </summary>

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

DescriptionAttribute("选定的值"),

ReadOnlyAttribute(false)]

public DateTime Value

{

get

{

if (IsNull())

dtValue = DateTime.MinValue ;

else

{

string strYear = tbYear.Text ;

string strMonth = tbMonth.Text ;

string strDay = tbDay.Text ;

string strDate = strYear +"-"+ strMonth +"-" +strDay ;
[1] [2]  下一页
  • 上一篇: 程序运行过程中动态改变控件大小的方法
  • 下一篇: 可用来显示空值的时间选择控件3
  •  告诉好友  打印此文 关闭窗口 返回顶部
     
    热点文章
     
     
    推荐文章
     
     
    相关文章

    | 设为首页 | 加入收藏 | 联系我们 | 友情链接 | 诚聘英才 |
    Copyright© 2008 ShaiIT.Com .All Rights Reserved
    下载alexa工具,提升您的网站排名