A TDateTime picker is a ComboBox where the drop-down list is replaced with a calendar. I use XE2 VCL Styles and changing style does'nt affect TDateTimePicker Color & Font Color. I have change the Calendar style with this question but the solution is not OK for the ComboBox, any idea ? Now I plan to inherit a TComboBox for use with a TMonthCalendar but I would know if anybody had a better solution.
相关问题
- Is there a Delphi 5 component that can handle .png
- Is there a way to install Delphi 2010 on Windows 2
- Is TWebBrowser dependant on IE version?
- iOS objective-c object: When to use release and wh
- DBGrid - How to set an individual background color
相关文章
- Best way to implement MVVM bindings (View <-> V
- Windows EventLog: How fast are operations with it?
- How to force Delphi compiler to display all hints
- Coloring cell background on firemonkey stringgrid
- HelpInsight documentation in Delphi 2007
- Can RTTI interrogate types from project code at de
- What specifically causes EPrivilege to be raised?
- Equivalent to designer guidelines in code
In order to use the workaround of the
CalColors
property, you must disable the Windows Theme in the drop down window of the TDateTimePicker component, for that you must use theDTM_GETMONTHCAL
message to get the window handle.Check this sample App
UPDATE 1
Change the background color of the "combobox" of the TDateTimePicker is a task limited by windows itself, because between others factors
SetBkColor
function has not effect in this control because theWM_CTLCOLOREDIT
message is not handled by this control.So a possible solution is intercept the
WM_PAINT
andWM_ERASEBKGND
messages and wrote your own code to paint the control. When you uses the Vcl Styles you can use a Style hook to handle these messages.Check this code (only as a proof of concept)
Note: This style hook doesn't draw the focused (selected) elements in the Inner text control (combobox) of the TDateTimePicker, i let this task for you.
UPDATE 2
I just wrote a vcl style hook which includes all the logic to apply the vcl style properly to the
TDateTimePicker
component, without use the OnDropDown event or the OnCreate event of the form. You can find the vcl style hook here (as part of the vcl styles utils project)To use it you must add the Vcl.Styles.DateTimePickers unit to your project and register the hook in this way.
For the Calendar itself... based on your other question...