How to make Round button in C#

This article demonstrates about how to make a round button in simple windows application and how to use it. .Net does not provide any round button control but you can make a round button with the helps of button class and Ellipse shape.

Round button

This article explain you step by step of making round button using C#.

1. Add a class named ‘RoundButton‘ in your windows application.
2. Create override Paint event like this:

  1. using System;
  2. using System.Drawing.Drawing2D;
  3. using System.Windows.Forms;
  4. public class RoundButton : Button
  5. {
  6.  protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
  7.  {
  8.   GraphicsPath grPath = new GraphicsPath();
  9.   grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
  10.         this.Region = new System.Drawing.Region(grPath);
  11.   base.OnPaint(e);
  12.  }
  13. }

3. Build your windows application, you can see a ‘roundbutton‘ control in your toolbox. drag and drop this control to your windows form, set the FlatAppearance property to ‘Flat’ and set the backcolor ‘brown’.

Create Round button

4. You can generate all events like Button control such as if you want to show ‘Welcome’ on click on roundbutton control , you need to create Click event like this:

  1. private void roundButton1_Click(object sender, EventArgs e)
  2.         {
  3.             MessageBox.Show("Welcome");
  4.         }

See also – How to create shaped Windows form

facebooktwittergoogle_plusredditpinterestlinkedinmail

8 thoughts on “How to make Round button in C#”

  1. i did it, rebuild it as well bt in form design i cant see my form instead of it m having this message “to add components of your class, drag them from tool box and use properties window to set their properties. to create method and event of your class click here to swtich to code view”

  2. great,but how to create it in windows mobile 6.5 ? ‘GraphicsPath’ is not suport in .Net CF.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>