views:

431

answers:

2

I am using the MonthCalendar controls in a Windows Forms application. I want to gray out the dates older than the control's MinDate (or give the user some visual clue about which dates are not valid for selection). The control has no property for getting the behaviour I expect. I have tried the UltraDateTimeEditor from Infragistics but it has the same problem (no property to set a color/style for dates before the MinDate).

How can I get what I want without having to code my own calendar control or doing too much low-level (i.e. custom drawing) stuff? Ideally, the solution should work on .Net framework 2.0, but if it needs 3.5, that's OK.

+3  A: 

The MonthControl seems to already do what you're looking for. Setting the minDate property removes the invalid days/years from the calendar so they can't be selected. Works in .NET 2.0 and 3.5.

Keep in mind, I'm using Windows Server 2008, so the visual styles for .NET controls may be different than on your system. Good luck!

Pwninstein
A: 

Without creating your own control or custom drawing, it can't be done.

Matt Hanson