Answer the question
In order to leave comments, you need to log in
How to remove the selection of an item in a comboBox in blue?
How to get rid of this, and why the hell did the developers do this? If you choose FlatStyle = System , then there is no selection, but you can’t edit it, it smells like the 90s, and if you choose the more fashionable Flat, the top is a poor selection color that can only be removed with a rake.
Only without OnPaint, I already solved this problem, but there must be a normal human way? I run into this problem every time.
And what is this event
Answer the question
In order to leave comments, you need to log in
Working with winforms - this is "hello from the 90s")
Therefore - just be careful like this ... squat for each sneeze:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_PAINT && DropDownStyle != ComboBoxStyle.Simple)
{
using (var g = Graphics.FromHwnd(Handle))
{
using (var p = new Pen(BorderColor))
{
g.DrawRectangle(p, 0, 0, Width - 1, Height - 1);
var d = FlatStyle == FlatStyle.Popup ? 1 : 0;
g.DrawLine(p, Width - buttonWidth - d,
0, Width - buttonWidth - d, Height);
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question