首页 > 编程 > .NET > 正文

刚写好的Asp.Net时间和日期的Label控件。作为讲解Asp.net控件开发的第一部分:继承开发

2024-07-10 13:03:57
字体:
来源:转载
供稿:网友
//==========================================================================
//名称: zyq.webcontrols.cultural.datetimepick.datetimepicklabel
//       asp.net服务控件
//版本: 1.0.0.0
//作者: 张宇庆
//日期: 2003.2.12
//email: [email protected]
//说明: 本控件及源代码只是为《计算机世界》开发者俱乐部asp.net论坛学习如何开发asp.net
//       服务器端控件而开发。未经本人同意请勿用作商业用途。
//
//==========================================================================
using system;
using system.globalization;

namespace zyq
{
    /// <summary>
    /// 继承自system.globalization.cultrueinfo
    /// 这个类在以后有关使用自定义system.globalization.cultrueinfo对象时可以使用。
    /// </summary>
    public class zyqcultrueinfo: cultureinfo
    {
        public zyqcultrueinfo(string name) : base(name)
        {
            
        }
        public zyqcultrueinfo(string name, bool useoverride) : base(name, useoverride)
        {
            //
            // todo: add constructor logic here
            //
        }
        /// <summary>
        /// 写重tostring()方法
        /// </summary>
        /// <returns>string:cultrueinfo对象的displayname</returns>
        public override string tostring()
        {
            return base.displayname;
        }
    
        public string getformatstring(string qiuckformat)
        {
            string str="";
            switch(qiuckformat)
            {                
                case "shortdate":
                    str=this.datetimeformat.shortdatepattern;
                    break;
                case "longdate":
                    str=this.datetimeformat.longdatepattern ;
                    break;
                case "fulldate":
                    str=this.datetimeformat.fulldatetimepattern;
                    break;
                case "rfc1123":
                    str=this.datetimeformat.rfc1123pattern;
                    break;
                case "iso8601":
                    str=this.datetimeformat.sortabledatetimepattern;
                    break;
                case "universalsortabledatetime":
                    str=this.datetimeformat.universalsortabledatetimepattern;
                    break;
                case "shorttime":
                    str=this.datetimeformat.shorttimepattern;
                    break;
                case "longtime":
                    str=this.datetimeformat.longtimepattern;
                    break;
                case "yearmonth":
                    str=this.datetimeformat.yearmonthpattern;
                    break;
                default:
                    str="mm/dd/yyyy hh:mm:ss";
                    break;
                
            }
            return str;
        }
    }
}
 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表