check point
This commit is contained in:
44
framework/MaterialSkin.Core/Controls/MaterialComboBox.cs
Normal file
44
framework/MaterialSkin.Core/Controls/MaterialComboBox.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace MaterialSkin.Controls
|
||||
{
|
||||
public partial class MaterialComboBox : ComboBox
|
||||
{
|
||||
|
||||
[Browsable(false)]
|
||||
public MaterialSkinManager SkinManager => MaterialSkinManager.Instance;
|
||||
public MaterialComboBox()
|
||||
{
|
||||
|
||||
DrawMode = DrawMode.OwnerDrawFixed;
|
||||
|
||||
DrawItem += AdvancedComboBox_DrawItem;
|
||||
|
||||
}
|
||||
|
||||
void AdvancedComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
if (e.Index < 0)
|
||||
return;
|
||||
|
||||
ComboBox combo = sender as ComboBox;
|
||||
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
|
||||
e.Graphics.FillRectangle(new SolidBrush(SkinManager.ColorScheme.AccentColor),
|
||||
e.Bounds);
|
||||
else
|
||||
e.Graphics.FillRectangle(new SolidBrush(combo.BackColor),
|
||||
e.Bounds);
|
||||
|
||||
e.Graphics.DrawString(combo.Items[e.Index].ToString(), e.Font,
|
||||
SkinManager.GetRaisedButtonTextBrush((e.State & DrawItemState.Selected) == DrawItemState.Selected),
|
||||
new Point(e.Bounds.X, e.Bounds.Y));
|
||||
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user