DateTimePicker,MonthCalendar控件的使用

来源:互联网 发布:手机恶作剧软件 编辑:程序博客网 时间:2024/04/29 03:21
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace DateTimePicker_MonthCalendar控件的使用{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)        {            this.monthCalendar1.SelectionStart = this.dateTimePicker1.Value;            this.monthCalendar1.SelectionEnd = this.dateTimePicker1.Value.AddDays(6);        }        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)        {            this.textBox1.Text = "其实日期:" + e.Start.ToLongDateString() + ";终止日期:" + e.End.ToLongDateString();        }    }}

原创粉丝点击