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.
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’.
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
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
Hello Zalmay
thanks for reading this article.
I try to solve your need in this new article ‘Round button with 3D effect‘ . You can read this article and let me know if you need any other improvment.
You can also post a message on authorcode forum . we will to try to help you.
Thanks
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
thanks
Nice Work
good.