Connecting Tech Pros Worldwide Forums | Help | Site Map

DateTimePicker BackColor DesignMode

Newbie
 
Join Date: Jan 2008
Location: Denver Colorado
Posts: 6
#1: Jan 4 '08
I have used the code I found on your site by Herr Wagner. It works perfectly except for one minor problem. The color does not change in design mode, only run mode.

Any suggestions
daniel aristidou's Avatar
Needs Regular Fix
 
Join Date: Aug 2007
Posts: 493
#2: Jan 5 '08

re: DateTimePicker BackColor DesignMode


Quote:

Originally Posted by llorracj

The color does not change in design mode, only run mode.

Which version of vb do you use?....
im not sure about vb6 but in later editions .....you can view the designcode......(This is the code the program uses to display and design your form.)
(not event code)..
I believe the code you placed was in the event area

you need to enter the code in the design area.
Newbie
 
Join Date: Jan 2008
Location: Denver Colorado
Posts: 6
#3: Jan 6 '08

re: DateTimePicker BackColor DesignMode


I'm using VB.Net 2005. I'm not sure what you mean by the "design area" and "event area".
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#4: Jan 7 '08

re: DateTimePicker BackColor DesignMode


I'm only VB6, but it seems unlikely that anything in your code would affect what the control looks like at design time.
Newbie
 
Join Date: Jan 2008
Location: Denver Colorado
Posts: 6
#5: Jan 7 '08

re: DateTimePicker BackColor DesignMode


.Net allows you to inherit from the Microsoft supplied controls. You can then add properties and methods to enhance the control. Unfortunately, in their infiinte wisdom, Microsoft decided to make the BackColor and ForeColor properties of the DateTimePicker control visible, but did not implement the properties. They also did not provided a user accessible Pain event. Setting the BackColor and ForeColor properties has no effect. If you want to change the BackColor of the DateTimePicker you need to implement your own BackColor property and and override the WndProc subroutine to have the property take effect (see http://dotnet.mvps.org/dotnet/faqs/?...color&lang=en). The code provided at the previously mentioned web site works fine and changes the color run mode but does not change the color in design mode, hence my original question.
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#6: Jan 8 '08

re: DateTimePicker BackColor DesignMode


Oops! :)
Reply