3

So I have been making a winforms project, the problem is that Windows 11 has rounded button corners which only appear on the Flatstyle: Standard setting. I have both a light mode and a dark mode in my application. The problem is that the button border is always white without any option to change this.

I would like to retain the native design option for windows 11 devices without the border colors being white, is this possible?

I would like to retain as much of the native design as possible so using a custom control will lead to all users on all devices having the same button style.

If it's not possible please link me to a guide on how I can make a custom button control that has rounded edges like that, or a library that has rounded button edges (please open source or free to use if possible.)

Thanks again :D

Keep in mind that overriding the buttons border in its Paint event leads to it drawing a rectangular border instead of it rounding or even changing it.

private void Btn_Paint(object sender, PaintEventArgs e)
{
      Button btn = (Button)sender;

       ControlPaint.DrawBorder(e.Graphics, btn.ClientRectangle,
       Color.Gray, 1, ButtonBorderStyle.Solid,
       Color.Gray, 1, ButtonBorderStyle.Solid,
       Color.Gray, 1, ButtonBorderStyle.Solid,
       Color.Gray, 1, ButtonBorderStyle.Solid);
}
SimpleCoder
  • 474
  • 4
  • 18

0 Answers0