How can I get a round button?

I would like to have round button controls in WinForms, how can I do this? Choosing a third-party control or code would be good.

+7
c # winforms
source share
6 answers

You can make your own quite easily, the Region property makes it simple. Add a new class to your project and paste the code shown below. Compilation. Drop the new control on top of the toolbar onto the form.

using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; class RoundButton : Button { protected override void OnResize(EventArgs e) { using (var path = new GraphicsPath()) { path.AddEllipse(new Rectangle(2, 2, this.Width - 5, this.Height - 5)); this.Region = new Region(path); } base.OnResize(e); } } 
+19
source share
+2
source share

Add a custom drawing to the OnPaint event handler.

+2
source share

Use WPF if it's too early in the project and you can still switch

+2
source share

I suggest the following two DLL files: PresentationCore.dll and PresentationFramework.dll

This is better known as the Windows Presentation Foundation (WPF), and it can be easily used to make round buttons .

+1
source share

You may have to create an image with rounded corners and use it on the image button to achieve what you want.

0
source share

All Articles