monthcalendar控件

来源:互联网 发布:卡西欧计算器软件 编辑:程序博客网 时间:2024/05/09 19:55

代码:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{    public partial class Form2 : Form    {        public Form2()        {            InitializeComponent();        }        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)        {            monthCalendar1.MaxSelectionCount = 10;        }        private void Form2_Load(object sender, EventArgs e)        {            button1.Text = "点击设置";            label1.Text = "日期最小值:";            label2.Text = "日期最大值:";        }        private void button1_Click(object sender, EventArgs e)        {            label1.Text = monthCalendar1.SelectionStart.ToLongDateString();            label2.Text = monthCalendar1.SelectionEnd.ToLongDateString();                       }    }}

运行结果: