I encountered this problem when using
System.Windows.Forms.MonthCalendar in my app. When the user changes and selects another month or year on
MonthCalendar, this component displays incorrectly (some dates are missing or are in bold). I think it's a problem with the
OnPaint() method of this component. It's really a Microsoft problem.
I asked my friends and searched on Google. Many people had faced the same problem, but had not found a solution yet.
Using the Code
I tested and saw that this problem occurred when calling
Application.EnableVisualStyles() in the Program.cs file.
To resolve this problem, I have given two ideals here:
- You should write one custom control or component which inherits or wraps this
MonthCalender of Microsoft and overrides the
OnPaint() method. It will help you to have a better component which supports your business (such as select range date on
mcalSelectDate.SelectionEnd = mcalSelectDate.SelectionStart into
private void mcalSelectDate_DateChanged(object sender, DateRangeEventArgs e)
mcalSelectDate.SelectionEnd = mcalSelectDate.SelectionStart;
Hope my suggestions will help you.
- 4th January, 2008: Initial post