How to change the Background Color of a Date Time Picker Control?
Hi,
How can I change the Background Color of a Date Time Picker Control?
:)
Re: How to change the Background Color of a Date Time Picker Control?
Hi,
Take a look at http://www.codeguru.com/controls/dat..._picker3.shtml . Is this what you are looking for ?
[b]Let me know if that helped.
Visit http://www.geocities.com/contactgirish/homepage.html for some VC++ Links & Notes.If you have time, you can sign the guest book there.
Regards,
V.Girish
Re: How to change the Background Color of a Date Time Picker Control?
No,
I don't want to change the background color of the droped down control.
Thanx anyway.
:)
Re: How to change the Background Color of a Date Time Picker Control?
override the: (WM_CTLCONTROL)
HBRUSH CDateTimePicker::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
//change the color
}
Re: How to change the Background Color of a Date Time Picker Control?
Hi,
I think the message you mean is the WM_CTLCOLOR. I could not find any WM_CTLCONTROL message.
Anyway I can't test it right now (I will in 8 hours) but the documentation doesn’t mention anything about DateTimePicker control, are you sure that this will work?
Re: How to change the Background Color of a Date Time Picker Control?
Yes, you are right, it is WM_CTLCOLOR. I was mistaken, because I was in hurry.
What about my hint, it sholud work because I used this overridable several times within CDialog, it worked. Since DateTimePicker is an object of CDateTimeCtrl class which is derived from CWnd as CDialog, HBRUSH CDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) should work. The only thing you gotta do is to create a new class derived from CDateTimeCtrl and manually override HBRUSH CDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor).
Let me know if it works.
Bayram.
Re: How to change the Background Color of a Date Time Picker Control?
Unfortunately it does not work. The control does not send any WM_CTLCOLOR message. I've tried MFC or plain Win32 API but the result is the same. I guess there is no way to change the background color this way.
Any ideas?
Re: How to change the Background Color of a Date Time Picker Control?
I've just saw another post with the same issue and they say that the answer is caching the WM_ERASEBKGND message. I don't know if this is true (I will test it in about 7 hours) but I can't believe it was that simple and I never think of it before.
I will let you know.
:)
Re: How to change the Background Color of a Date Time Picker Control?
Hi there, how are you going on with the DateTimePicker? Have you got any result?
After some struggle I have had some result. As you know DTP has two windows: first is main which looks like CEdit ctrl and another one is MonthCalendar. I dealt with the first. I want to send you the project (zip), but I do not know your e-mail address.
Reply.
Regard!
Brm.
Re: How to change the Background Color of a Date Time Picker Control?
No need to send me anything, it works with WM_ERASEBKGND. I can't believe it was that simple and I did't think of it before.
Thanx for your time. Bye!
Re: How to change the Background Color of a Date Time Picker Control?
Hello
I have read all the thread , my task is similar to change the color of Dropdown of timepicker in MFC.By Erasebackground i got achieved to color the background of the dropdown control, how to change the color of text,
Anybody have any ideas
thanks in advance