Name

MonthCalendar

Synopsis

This Control represents a calendar for selecting a single date or a range of dates. It is more powerful than the DateTimePicker control, but it takes up a lot more real estate.

To alter the appearance of the control, you can set the CalendarDimensions to specify the number of columns and rows of months to display (1x1 would look like a single calendar month, 6x2 would allow you to display an entire year). The minimum size of any individual month can be determined with SingleMonthSize.

The current date can be shown with a circle by specifying ShowTodayCircle, or as some text at the bottom of the control with the ShowToday property. You can also change what the calendar believes to be today’s date with the TodayDate property. TodayDateSet will tell you whether this has been explicitly modified. You can also specify the FirstDayOfWeek and, optionally, ShowWeekNumbers.

In addition to the standard Control appearance properties, you can independently set the TitleBackColor, TitleForeColor, and TrailingForeColor (the color of the days from last and next month that are shown on a calendar grid).

You can also set specific dates to be displayed with bold text either individually with BoldedDates, monthly with MonthlyBoldedDates, or annually with AnnuallyBoldedDates. While you can use these properties to get and set the dates concerned, they return copies of the internal date arrays. It is more efficient to use AddBoldedDate(), AddMonthlyBoldedDate(), and AddAnnuallyBoldedDate() ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.