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

34,424

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:

Share:
34,424
SpongeBob SquarePants
Author by

SpongeBob SquarePants

Top Secret I live Deep down in the Pacific Ocean in the subterranean city of Bikini Bottom in a pineapple along with my pet Gary. I make delicious Krabby Patty Burger at Krusty Krabs. My favorite quote: Isn't this great Squidward? Its just the 3 of us. You, me, and this brick wall you built between us

Updated on February 13, 2020

Comments

  • SpongeBob SquarePants
    SpongeBob SquarePants over 4 years

    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...

  • SpongeBob SquarePants
    SpongeBob SquarePants over 13 years
    That will only make the dates bold , I want to change the color of of some particular dates
  • SpongeBob SquarePants
    SpongeBob SquarePants over 13 years
    Is there any 3rd party component which would make the job easy ?
  • SpongeBob SquarePants
    SpongeBob SquarePants over 13 years
    Can you explain your Code?, I have no idea what it means
  • william
    william over 13 years
    I know that is possible for web calendar. But I m not sure for Winform in 2005. Why dun u try 2010. There are a lot more features for C# in 2010
  • Cody Gray
    Cody Gray over 13 years
    This isn't a C# feature, it's a WinForms feature. And it's certainly not one that is added by VS 2010 (.NET 4.0).
  • Cody Gray
    Cody Gray over 13 years
    @abcd: Not one that I know of or could personally recommend. I've updated my answer with a few that a quick Google search turns up.
  • william
    william over 13 years
    Sry. I m just guessing. I've never used 2010 yet. Your answer is fascinating. Tkz..
  • Urbycoz
    Urbycoz almost 11 years
    These are all C#. Does anyone know of any VB.net controls?
  • Cody Gray
    Cody Gray almost 11 years
    @Urbycoz It doesn't matter what language the controls are in. Just reference the DLL from your solution. Or, if you want to access the source code, add a new C# project to your existing solution and reference the DLL that it builds.