A few weeks ago I mentioned (if not here, somewhere els) I had been working on a replacement DateTimePicker control for one of our projects, because the base DateTimePicker control in Windows Forms did not really support the .NET style of globalization, as it is based on the native OS control which is only aware of the currently selected regional settings. The problem is that our application needed to be controled explicitly only by the culture selected in the Windows Application itself (CurrentCulture/CurrentUICulture), and not have a mixed bag of controls in incompatible formats/languages.

However, I never did write about what the end result looked liked :)

I'm not much of a control designer/developer, but I must admit that writing windows forms controls can be very entertaining at times (and quite frustrating, others), but, if I may say so myself, I was quite pleased by the end result: A control that looked fairly similar to the original native MonthCalendar and DateTimePicker controls. Granted, they are simpler (they don't support a lot of the extra stuff the native ones support, which we didn't need, like multi-month display, or selection of date ranges), but they could certainly be extended if needed.

And, of course, they actually do work based on the date formats selected in the current culture :). Here's a small screenshot of what they look like:

Controls Picture

While working with these, I did get a chance to explore a few very nifty new features in Windows Forms 2.0, like the new visual styles support in System.Windows.Forms.VisualStyles, the ToolStripControlHost class (for a cool example see here), and all the cool stuff in the System.Globalization namespace.


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.