You can do highlight some specific dates such as holidays in MonthCalendar control. MonthCalendar control can display singular date or dates on a repeating basis in Bold type.
These controls provide us three basic properties for doing this these are as follows:
BoldedDates property: we can assign an array of bold dates. contains single dates in bold.
AnnuallyBoldedDates property : we can assign an array of bold dates that appear in bold every year.
MonthlyBoldedDates property: we can assign an array of bold dates that appear in bold every month.
We can set these properties with the help of properties windows as well as code
BoldedDates:
[vb.net]
Private Sub BoldDates() Dim holidayDate1 As Date = New DateTime(2011, 9, 25) Dim holidayDate2 As Date = New DateTime(2011, 9, 30) MonthCalendar1.AddBoldedDate(holidayDate1) MonthCalendar1.AddBoldedDate(holidayDate2) End Sub
—or—
Private Sub BoldDates() MonthCalendar1.BoldedDates = New System.DateTime() {New System.DateTime(2011, 9, 25), New System.DateTime(2011, 9, 30)} End Sub
[C#.net]
private void BoldDates() { System.DateTime holidayDate1 = new DateTime(2011, 9, 25); System.DateTime holidayDate2 = new DateTime(2011, 9, 30); MonthCalendar1.AddBoldedDate(holidayDate1); MonthCalendar1.AddBoldedDate(holidayDate2); }
–or—
private void BoldDates() { MonthCalendar1.BoldedDates = new System.DateTime[] { new System.DateTime(2011, 9, 25), new System.DateTime(2011, 9, 30)}; }
AnnuallyBoldedDates
determines which annual days are displayed in bold.
[vb.net]
Private Sub BoldAnuallyDates() Dim holidayDate1 As Date = New DateTime(2011, 9, 25) Dim holidayDate2 As Date = New DateTime(2011, 9, 30) MonthCalendar1.AddAnnuallyBoldedDate(holidayDate1) MonthCalendar1.AddAnnuallyBoldedDate(holidayDate2) End Sub
–or—
Private Sub BoldAnuallyDates() MonthCalendar1.AnnuallyBoldedDates= New System.DateTime() {New System.DateTime(2011, 9, 25), New System.DateTime(2011, 9, 30)} End Sub
[C#.net]
private void BoldAnuallyDates() { System.DateTime holidayDate1 = new DateTime(2011, 9, 25); System.DateTime holidayDate2 = new DateTime(2011, 9, 30); MonthCalendar1.AddAnnuallyBoldedDate(holidayDate1); MonthCalendar1.AddAnnuallyBoldedDate(holidayDate2); }
–or—
private void BoldAnuallyDates() { MonthCalendar1.AnnuallyBoldedDates= new System.DateTime[] { new System.DateTime(2011, 9, 25), new System.DateTime(2011, 9, 30)}; }
MonthlyBoldedDates
determines which monthly days are displayed in bold.
[vb.net]
Private Sub BoldMonthlyDates() Dim holidayDate1 As Date = New DateTime(2011, 9, 25) Dim holidayDate2 As Date = New DateTime(2011, 9, 30) MonthCalendar1.AddMonthlyBoldedDate(holidayDate1) MonthCalendar1.AddMonthlyBoldedDate(holidayDate2) End Sub
–or—
Private Sub BoldMonthlyDates() MonthCalendar1.MonthlyBoldedDates= New System.DateTime() {New System.DateTime(2011, 9, 25), New System.DateTime(2011, 9, 30)} End Sub
[C#.net]
private void BoldMonthlyDates() { System.DateTime holidayDate1 = new DateTime(2011, 9, 25); System.DateTime holidayDate2 = new DateTime(2011, 9, 30); MonthCalendar1.AddMonthlyBoldedDate(holidayDate1); MonthCalendar1.AddMonthlyBoldedDate(holidayDate2); }
–or—
private void BoldMonthlyDates() { MonthCalendar1.MonthlyBoldedDates= new System.DateTime[] { new System.DateTime(2011, 9, 25), new System.DateTime(2011, 9, 30)}; }