Better dark theme buttons

This commit is contained in:
Jaex 2019-06-25 19:12:34 +03:00
parent cf797e801c
commit 2b15df420c
2 changed files with 11 additions and 3 deletions

View file

@ -67,9 +67,12 @@ protected override void OnPaint(PaintEventArgs pevent)
int arrowX = ClientRectangle.Width - 14; int arrowX = ClientRectangle.Width - 14;
int arrowY = (ClientRectangle.Height / 2) - 1; int arrowY = (ClientRectangle.Height / 2) - 1;
Brush brush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ControlDark; Color color = Enabled ? ForeColor : SystemColors.ControlDark;
Point[] arrows = new Point[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) }; using (Brush brush = new SolidBrush(color))
pevent.Graphics.FillPolygon(brush, arrows); {
Point[] arrows = new Point[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) };
pevent.Graphics.FillPolygon(brush, arrows);
}
} }
} }
} }

View file

@ -101,6 +101,11 @@ private static void ApplyDarkThemeToControl(Control control)
switch (control) switch (control)
{ {
case Button btn: case Button btn:
btn.FlatStyle = FlatStyle.Flat;
btn.FlatAppearance.BorderColor = DarkBorderColor;
btn.ForeColor = DarkTextColor;
btn.BackColor = DarkBackgroundVariantColor;
return;
case CheckBox cb when cb.Appearance == Appearance.Button: case CheckBox cb when cb.Appearance == Appearance.Button:
// Buttons looks better with system colors // Buttons looks better with system colors
control.ForeColor = SystemColors.ControlText; control.ForeColor = SystemColors.ControlText;