c# 日历 c# 日历控件的实现

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

c# 日历 c# 日历控件的实现

哈哈哈嗝   2021-01-28 我要评论
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();
  }
}

实现效果

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们