LOGIN    REGISTER    YOUR CART

homepage
VisualHint's blog
2005
Nov06

DateTimePicker, PropertyGrid and BackColor wedding

The Microsoft PropertyGrid doesn’t use the DateTimePicker control to edit a date. It uses a simple dropped down month calendar and therefore it is not even possible to edit a time only. This was the indication of a challenge for me.

If you do a search with the keywords "DateTime BackColor" on the web and on the newsgroups you will find a lot of posts asking how to change the BackColor of a DateTimePicker control as well as answers saying that it is not so obvious and that you could try this way and this way. Nothing clear. Since I had not a lot of bugs to fix in the last days, I decided to add the DateTimePicker control as a feel for the first release of SPG. And after several days of pain and despair, I finally got it working and integrated in the PropertyGrid. Here it is: PropertyGrid and DateTime

PropertyGrid and DateTime

There was several difficulties. The first one was to show the proper BackColor. Once done, I discovered that when made initially visible, there was a nasty flickering effect. So I had to fix that to get the same quality standard as all the other inplace controls. I did it but the fix was producing erratic drawing when clicking on the fieds of the control or using the arrow keys to change the values. Well, now this is done and I am pretty proud of it.

You can see it in action in the new build 11 and the updated sample application.