We have a WinForms control that is an extended version of ComboBox
that supports "cue banners" (aka watermarks) when there is no selection or text. Our control is similar to this implementation making use of CB_SETCUEBANNER.
However, when we set DropDownStyle
for the control to ComboBoxStyle.DropDown
(that is, also allows free text entry) the cue banner is showing, just not in italics (which is how it usually shows).
Does anyone know how to draw the cue banner in italics for a combo box in ComboBoxStyle.DropDown
mode???
By design. When the Style = DropDown, the text portion of the combobox is a TextBox. Which displays the cue banner in non-italic style. You can verify with this code. It is otherwise important to make the distinction between the banner and the actual selection visible when the Style = DropDownList, no doubt the reason they chose to display it italic. TextBox does it differently, it hides the banner when it gets the focus.
Throwing in a non exhausting version:
Simpler version for C# WinForms:
After that you can easily set the property text to italic and change it for when the user clicks or types.
For Example: