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

- 中国WEB开发者网络 (http://www.webasp.net)
-- 技术教程 (http://www.webasp.net/article/)
--- 刚写好的Asp.Net时间和日期的Label控件。作为讲解Asp.net控件开发的第一部分:继承开发(4) (http://www.webasp.net/article/5/4129.htm)
-- 作者:未知
-- 发布日期: 2003-07-12
//==========================================================================
//名称: ZYQ.WebControls.Cultural.DateTimePick.DateTimePickLabel
//       Asp.Net服务控件
//版本: 1.0.0.0
//作者: 张宇庆
//日期: 2003.2.12
//Email: raxzhang@sina.com
//说明: 本控件及源代码只是为《计算机世界》开发者俱乐部Asp.Net论坛学习如何开发Asp.net
//       服务器端控件而开发。未经本人同意请勿用作商业用途。
//
//==========================================================================
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using ZYQ.WebControls.Cultural.DateTimePick;     
namespace ZYQ.WebControls.Cultural.Design
{
    /// <summary>
    /// ZYQ 的摘要说明。
    /// </summary>
    public class DateTimePickDesign:UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }
        public override object EditValue(ITypeDescriptorContext context,IServiceProvider provider,object value)
        {
            object retvalue=value;
            IWindowsFormsEditorService srv=null;

            //
            if(provider !=null)
                srv=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if(srv!=null)
            {
                DateTimePickEditor form= new DateTimePickEditor();
                form.DesignerSetting =(DTFormatSetting)value;
                if(srv.ShowDialog(form)==DialogResult.OK)
                    return form.DesignerSetting;
            }
            return retvalue;
        }
    }
}

webasp.net