ExComboBox
ExComboBox is a ComboBox that draws itself with separate colors for the normal, hover, selected and disabled states.
ExToolStripComboBox hosts it in a tool strip and DataGridViewExComboBoxColumn in a grid.
Custom style
With DefaultStyle = false the combo box takes the colors of the current state from one of four ExComboBoxStyle
objects:
| Property | State |
|---|---|
StyleNormal |
Not focused and not under the mouse. |
StyleHighlight |
Under the mouse. |
StyleSelected |
Focused. |
StyleDisabled |
Disabled. |
Each style has BackColor, ForeColor, BorderColor, ArrowColor, ButtonBackColor, ButtonBorderColor and
ButtonRenderFirst (whether the drop-down button is drawn before the border). The drop-down list has its own
DropDownBackColor and DropDownSelectedRowBackColor, and UseDarkScrollBar gives it dark scroll bars.
BackColor and ForeColor of the control are written into StyleNormal as well.
Theme
| Theme color | Used for |
|---|---|
BoxBackColor, BoxForeColor |
Background and text. |
BorderColor |
Border in the normal state, text of a disabled combo box. |
HighlightBackColor |
Border and button under the mouse and with focus, selected row of the drop-down list. |
PanelBackColor |
Background of the drop-down list. |
DarkScrollBars |
Scroll bars of the drop-down list. |
A combo box set to the custom style in the designer keeps it also when a theme with UseSystemStyle is applied.
In a tool strip
ExToolStripComboBox is a ToolStripControlHost with the API of ToolStripComboBox (Items, SelectedIndex,
DropDownStyle, SelectedIndexChanged…) and the hosted control in ComboBox. Its theme uses ButtonBackColor and
ButtonForeColor for the field, so it matches the buttons of the tool strip. A handler for the tool strip applies the
theme to it:
foreach (var item in toolStrip.Items.OfType<IThemeable>())
item.ApplyTheme(theme);


