简体   繁体   English

从月份日历控件中删除选定的日期

[英]Remove selected date from a month calendar control

On my form I have a clear button that is supposed to reset the form back to it's original settings, and as such, I need to de-select any dates a user has selected on my month calendar, but cannot figure out how to do this. 在我的表单上,我有一个清除按钮,该按钮应该将表单重置为原始设置,因此,我需要取消选择用户在我的月历中选择的任何日期,但是无法弄清楚该如何做。 。

So, is there a way to remove all dates selected by the user on a month calendar? 因此,有没有办法删除用户在月历上选择的所有日期?

You can set the Selection start and end to a specific date. 您可以将选择的开始和结束设置为特定日期。

var today = DateTime.Today;
monthCalendar1.SelectionStart = today;
monthCalendar1.SelectionEnd = today;

do you mean something like this: http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.removeallboldeddates.aspx 您的意思是这样的吗: http : //msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.removeallboldeddates.aspx

Or something like this: 或类似这样的东西:

calendar.SetDate(DateTime.Now)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM