How can I change the color of certain dates in the MonthCalendar control?

SpongeBob SquarePants picture SpongeBob SquarePants · Feb 19, 2011 · Viewed 33.2k times · Source

How can I change the color of certain dates in the MonthCalendar control in VB.NET?

For example, I need to change the color of Jan 21 to Red, Sundays to Orange and so on...

Answer

Cody Gray picture Cody Gray · Feb 19, 2011

This is not possible. There is no built-in way of customizing the way that individual days or dates are displayed on the MonthCalendar control.

You could owner-draw the control, but that's way too much work to justify. This will make you responsible for drawing the entire control yourself. Note that if you choose to go this route, the MonthCalendar control does not raise the Paint event because the base control sets the UserPaint bit to "False". You will have to subclass the control and override its OnPrint method instead.

I can't personally recommend any third-party controls that provide this level of customization, but a quick Google search does appear to turn up a few options: