Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
SDClowen committed May 28, 2022
1 parent 6b8d556 commit bed14db
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions SDUI/Controls/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ public class ComboBox : System.Windows.Forms.ComboBox
{
protected override void OnDrawItem(DrawItemEventArgs e)
{
base.OnDrawItem(e);

var index = e.Index;
if (index < 0 || index >= Items.Count)
return;

var backColor = ColorScheme.BackColor;
var foreColor = ColorScheme.ForeColor;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
backColor = ColorScheme.ForeColor.Alpha(15);
{
foreColor = Color.White;
e.DrawBackground();
}
else
e.Graphics.FillRectangle(new SolidBrush(ColorScheme.BackColor), e.Bounds);

e.Graphics.FillRectangle(new SolidBrush(backColor), e.Bounds);
TextRenderer.DrawText(e.Graphics, GetItemText(Items[index]), e.Font, e.Bounds, ColorScheme.ForeColor, TextFormatFlags.Left);
TextRenderer.DrawText(e.Graphics, GetItemText(Items[index]), e.Font, e.Bounds, foreColor, TextFormatFlags.Left);
}

protected override void OnParentBackColorChanged(EventArgs e)
Expand Down

0 comments on commit bed14db

Please sign in to comment.