Linked Questions

Popular Questions

Make a Button Round in C# or Vb (Windows Form)

Asked by At

I want to make a round button for a media player, as well as these buttons: buttons

I have managed to do it with the following code:

public partial class UserControl1 : Button
{
    public UserControl1()
    {
        InitializeComponent();
        FlatStyle = FlatStyle.Flat;
        FlatAppearance.BorderSize = 0;
        BackColor = Color.Red;
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        GraphicsPath grPath = new GraphicsPath();
        grPath.AddEllipse(0, 0, ClientSize.Width-3, ClientSize.Height-3);
        this.Region = new Region(grPath);
        base.OnPaint(e);
    }
}

But the round shape looks bad, as if it was pixelated or as if it did not have good quality, I attached a photo:

photo

I would like you to help me with code in C # or Visual Basic, for Windows Form.

Related Questions