The following ComboBoxEdit.DrawItem event handler shows how you can perform custom painting of items in the dropdown list.
Selected items are drawn with the bold font. For other items, the default control's painting is performed.
The following image shows a combo box editor whose items are drawn in this manner:
using DevExpress.XtraEditors; private void comboBoxEdit1_DrawItem(object sender, ListBoxDrawItemEventArgs e){ if ((e.State & DrawItemState.Selected) > 0) { Font boldFont = new Font(e.Appearance.Font.FontFamily, e.Appearance.Font.Size, FontStyle.Bold); e.Graphics.DrawString(e.Item.ToString(), boldFont, new SolidBrush(e.Appearance.ForeColor), e.Bounds); e.Handled = true; } }
Private Sub ComboBoxEdit1_DrawItem(ByVal sender As Object, _ ByVal e As DevExpress.XtraEditors.ListBoxDrawItemEventArgs) _ Handles ComboBoxEdit1.DrawItem If (e.State And DrawItemState.Selected) > 0 Then Dim boldFont As Font = New Font(e.Appearance.Font.FontFamily, e.Appearance.Font.Size, _ FontStyle.Bold) Dim brush As SolidBrush = New SolidBrush(e.Appearance.ForeColor) Dim rect As RectangleF = New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, _ e.Bounds.Height) e.Graphics.DrawString(e.Item.ToString(), boldFont, brush, rect) e.Handled = True End If End Sub