A very easy way to show different string values than the Items is to set the Style property from
csDropDowntocsOwnerDrawFixedas Andreas Rejbrand has answered a few years ago.The thing is: as soon as you do that, you loose Windows Theming support.
The same limitation applies to usingcsOwnerDrawVariableThese two
Stylevalues get translated into adding theCBS_OWNERDRAWFIXEDorCBS_OWNERDRAWVARIABLE(in addition toCBS_DROPDOWNLIST) styles of the Windows COMBOBOX control.In turn,
CBS_OWNERDRAWFIXEDorCBS_OWNERDRAWVARIABLEcause you to instantly loose the Windows theming support.When you do full custom painting like a colour picker, that is all fine. But when you only want to replace the drawn text, it is not.
The Windows COMBOBOX control does not seem to have a way around this, so I’m wondering: how can you simulate the Windows theming from Delphi?
I assume it has to do with DrawThemedBackground, but it has been a while since I’ve done serious Delphi Control work, so any pointers on how to get started there are fine too (even if they invalidate my assumption).
delphi – How to simulate Windows Theme behaviour when TComboBox uses csOwnerDrawFixed or csOwnerDrawVariable? – Stack Overflow
Posted by jpluimers on 2013/04/17
Some notes if I ever want to do something like this.
In this case I worked around it by having the Items include different text (since I had object pointers in the TStrings anyway) so I could stick to the csDropDown Style.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
–jeroen






ObjectMethodology.com said
The website doesn’t look right.
jpluimers said
It looked right when I initially copied it from StackOverflow. Will try to fix it.
jpluimers said
Fixed it. Some class votecell TD somehow got extra wide.