How to make Round button in vb.net

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

Round button in vb.net

This article explain you step by step of making round button using vb.net.

1. Add a class named ‘RoundButton’ in your windows application.
2. Create override ‘OnPaint’ property like this:

Imports System.Drawing.Drawing2D
Public Class RoundButton
    Inherits Button
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim grPath As GraphicsPath = New GraphicsPath()
        grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height)
        Me.Region = New Region(grPath)
        MyBase.OnPaint(e)
    End Sub
End Class

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’.

Round button in design time

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:

Private Sub RoundButton1_Click(ByVal sender As System.Object, _
              ByVal e As System.EventArgs) Handles RoundButton1.Click
        MessageBox.Show("Welcome")
 End Sub

5 thoughts on “How to make Round button in vb.net”

  1. Hello Sir
    Your Round Button work is excellent but I have  a question How can we make this to 3D button. I will  be glade If I may  be  provided  with guidance or piece of code to do it.thanks
    Zalmay 

    1. hi , thanks for the posting this !.

      Actually , the button which created y this post are not exactly in round shape..

      Please kindly update the code.

      Thanks in Advance

Comments are closed.