Click here to Skip to main content
12,945,706 members (49,456 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 3 Jan 2008

MonthCalendar Has a Problem When Displaying

, 4 Jan 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
MonthCalendar has a problem when displaying


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:

  1. 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 MonthCalender).
  2. Add mcalSelectDate.SelectionEnd = mcalSelectDate.SelectionStart into MonthCalendar_DateChanged event.
private void mcalSelectDate_DateChanged(object sender, DateRangeEventArgs e)
     mcalSelectDate.SelectionEnd = mcalSelectDate.SelectionStart;

Hope my suggestions will help you.


  • 4th January, 2008: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) FPT Software JSC & VietSoftware International
Vietnam Vietnam
Programming is my hobby!
Vietanh154, or
Manager for Concat Group: http://nhó
Project Manager & Technical Leader for FPT Software JSC
Solution Architect & Technical Manager for VietSoftware International

Microsoft Certified Application Developer For Microsoft .NET
Microsoft Certified Professional MCP 2.0 -- Certified Professional
Developing and Implementing Web Applications with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET
Developing and Implementing Windows®-based Applications
with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET
Developing XML Web Services and Server Components with
Microsoft Visual C# .NET and the Microsoft .NET Framework

You may also be interested in...


Comments and Discussions

Generalbai gi ma ngan the! Pin
matrix198411-Sep-08 23:31
membermatrix198411-Sep-08 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 4 Jan 2008
Article Copyright 2008 by vietanh154
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid