zoukankan      html  css  js  c++  java
  • ToolStrip添加自定义的DateTimePicker

    直接新建一个类,代码如下:

    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All), DefaultEvent("ValueChanged")]
    public class ToolStripDateTimePicker : ToolStripControlHost
    {
        private DateTimePicker mDateTimePicker;
    
    
        public ToolStripDateTimePicker() : base(new DateTimePicker())
        {
            mDateTimePicker = DateTimePicker;
            mDateTimePicker.ValueChanged += mDateTimePicker_ValueChanged;
        }
    
    
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public DateTimePicker DateTimePicker
        {
            get { return (DateTimePicker) Control; }
        }
    
    
        [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
        public override string Text
        {
            get { return string.Empty; }
            set { base.Text = string.Empty; }
        }
    
        public event EventHandler ValueChanged;
    
    
        private void mDateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            if (ValueChanged != null)
            {
                ValueChanged(sender, e);
            }
        }
    }
    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All), DefaultEvent("ValueChanged")]
    public class ToolStripDateTimePicker : ToolStripControlHost
    {
        private DateTimePicker mDateTimePicker;
    
    
        public ToolStripDateTimePicker() : base(new DateTimePicker())
        {
            mDateTimePicker = DateTimePicker;
            mDateTimePicker.ValueChanged += mDateTimePicker_ValueChanged;
        }
    
    
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public DateTimePicker DateTimePicker
        {
            get { return (DateTimePicker) Control; }
        }
    
    
        [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
        public override string Text
        {
            get { return string.Empty; }
            set { base.Text = string.Empty; }
        }
    
        public event EventHandler ValueChanged;
    
    
        private void mDateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            if (ValueChanged != null)
            {
                ValueChanged(sender, e);
            }
        }
    }
  • 相关阅读:
    layout布局
    窗口、easyui-window、easyui-panel、easyui-linkbutton
    FASTJSON
    Insert title here
    Insert title here
    Scala并发编程
    scala中java并发编程
    scala调用外部命令
    scala正则表达式
    scala占位符_的用法
  • 原文地址:https://www.cnblogs.com/equation/p/5717379.html
Copyright © 2011-2022 走看看