软件编程
位置:首页>> 软件编程>> C#编程>> c# 日历控件的实现

c# 日历控件的实现

作者:哈哈哈嗝  发布时间:2022-08-21 11:02:22 

标签:c#,日历

public partial class MonthCalendarForm : Form
{
 public MonthCalendarForm()
 {
   InitializeComponent();
 }
 //窗体加载事件
 private void MonthCalendarForm_Load(object sender, EventArgs e)
 {
   //隐藏日历控件
   monthCalendar1.Hide();
 }
 //“选择”按钮的单击事件
 private void button1_Click(object sender, EventArgs e)
 {
   //显示日历控件
   monthCalendar1.Show();
 }
 //日历控件的日期改变事件
 private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e)
 {
   //将选择的日期显示在文本框中
   textBox1.Text = monthCalendar1.SelectionStart.ToShortDateString();
   //隐藏日历控件
   monthCalendar1.Hide();
 }
}

实现效果

c# 日历控件的实现

来源:https://www.cnblogs.com/Liyuting/p/7059610.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com