I am trying to manage the color of the ComboBox. While it is possible to change the background color, I cannot find a property for the border outline.
Just drawing a square as border wont do in a dark theme because of the arrow. This leads me to the conclusion that this border might be an actual image file.
Is it possible to replace this?
UPDATE: I have implemented the Solution of @AhmedAbdelhameed - It looks a lot better now. However for the flat style, I had to adjust the rectangle like the following:
using (var p = new Pen(this.BorderColor, 1))
{
g.DrawRectangle(p, 0, 0, Width - buttonWidth - 1, Height - 1);
}
I also exchanged the 'BorderColor' to match the rest of my UI:
public CustomComboBox()
{
BorderColor = Color.Gray;
}
What I would like to be able to do now is to change the actual drop down button (maybe with an overlay png) only in dark theme
UPDATE: I have been able to add a pricturebox to the custom Control with the following code:
using (var g = Graphics.FromHwnd(Handle))
{
using (var p = new Pen(this.BorderColor, 1))
{
g.DrawRectangle(p, 0, 0, Width - buttonWidth - 1, Height - 1);
}
if (Properties.Settings.Default.Theme == "Dark")
{
g.DrawImageUnscaled(Properties.Resources.dropdown, new Point(Width - buttonWidth - 1));
}
}
it looks awesome! more or less by coincidence which I do not understand, the dark dropdown button even disappears, when I change the theme in the theme combobox.
BackColor
. For more information, please read here