简体   繁体   中英

How to insert multiple date in DateTimePicker?

I've some date that I must insert in this control. Each date must be recognized by the user by the color of the day. I want to know how to insert multiple date in DateTimePicker, for example I've:

20/07/2015<br>
21/07/2015<br>
22/07/2015<br>

And the final result in the DataTimePicker will be:

在此处输入图片说明

How can I do this?

您可以将这些日期添加到控件的SelectedDates中,也可以更改选择样式。

To do multiple dates your best bet is to utilize the MonthCalendar class/control, once you spin one up you have a few styles you can assign dates to, for example:

this.monthCalendar1.AnnuallyBoldedDates = 
            new System.DateTime[] { new System.DateTime(2015, 7, 20, 0, 0, 0, 0),
                                    new System.DateTime(2015, 7, 21, 0, 0, 0, 0)};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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