当前位置:开发者网络 >> 技术教程 >> .NET教程 >> 组件控件开发 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
刚写好的Asp.Net时间和日期的Label控件。作为讲解Asp.net控件开发的第一部分:继承开发(4)
作者:未知
日期:2003-07-12
人气:
投稿:Andy.m(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
//==========================================================================
//名称: 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;
        }
    }
}
相关文章: