Click here to Skip to main content
15,443,982 members
Articles / Programming Languages / Visual Basic
Posted 18 May 2011


27 bookmarked

Creating Windows Rounded Rectangular and Circular Forms

Rate me:
Please Sign up or sign in to vote.
4.19/5 (17 votes)
10 Jun 2011CPOL2 min read
Designing forms with rounded corners using Visual Studio 2010
Sample Image - maximum width is 600 pixels

Sample Image - maximum width is 600 pixels


This article guides you how to create forms with rounded corners. This article is helpful for those who wanted to create forms with rounded corners, in contrast to those regular forms, but are stuck and can’t understand how to do it? Now, there is no need to panic. This project will show you how to make a program that creates forms with rounded corners. Make your forms different from others and change the look of your application in a way that appeals to the user.

Using the Code

Main Coding

First start a new project, select window form application and save it as "sampleprogram". You will see a form is created named as "Form1.vb", Rename it as "frmmain" in the Solution Explorer (if you have not found the solution explorer, then select it from Menu "View->Solution Explorer". Alternatively, you can use shortcut keys, i.e. ctrl+alt+L). Double click frmmain.vb to see the design view. Now, before going further, set the following properties of the form 'frmmain':

  • MaximizeBox: False
  • MinimizeBox: False
  • StartPosition: CenterScreen
  • Size: 500,500
  • FormBorderStyle: None

Now, click on the "View Code" and write the following code in the frmmain's paint method.
i.e. Write the Subroutine "frmmain_Paint".

Public Class frmmain

    Private Sub frmmain_Paint(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim gp As New System.Drawing.Drawing2D.GraphicsPath
        If cirOrec = 0 Then 'If Rounded Rectangle is selected

            If intval = 0 Then 
                intval = 200
            End If

        Dim chgcorn As Integer = intval  'Change the value and get the 
        'desired Rounded corner, 
        'keep in mind that the value should be divisible by 10.

        ' check whether the entered number is divisible by 10 or not, 
        ' if not then make it.
        If chgcorn Mod 10 <> 0 Then
            chgcorn = chgcorn - (chgcorn Mod 10)
        End If

        Dim r1 As New Rectangle(0, Me.Height - chgcorn, chgcorn, chgcorn)
        Dim r2 As New Rectangle(Me.Width - chgcorn + 1, _
			Me.Height - chgcorn, chgcorn, chgcorn)

        'creating the upper Arc
        gp.AddArc(0, 0, chgcorn, chgcorn, 180, 90)
        gp.AddArc(Me.Width - chgcorn + 1, 0, chgcorn, chgcorn, 270, 90)

        'Creating the Body
        gp.AddRectangle(New Rectangle(0, chgcorn / 2, Me.Width, Me.Height - chgcorn))

        'Creating the lower Arc
        gp.AddArc(r1, -270, 90)
        gp.AddArc(r2, 360, 90)

        Me.BackColor = Color.Black
	   Else              'If Circular form type is selected
            If intval = 0 Then
                intval = Me.Width
            End If
            If intval2 = 0 Then
                intval2 = Me.Height
            End If
            gp.AddEllipse(New Rectangle(0, 0, intval, intval2))
            Me.BackColor = Color.IndianRed
        End If
        Region = New Region(gp)
    End Sub

   'Now code for closing the Form1 

   Private Sub frmmain_Click(ByVal sender As System.Object, _
		ByVal e As System.EventArgs) Handles Button1.Click
    End Sub
End Class

NOTE: Select the Form type you want to create from the combobox. For Rounded rectangular form, enter the arc value, and hit create button.

Sample Image - maximum width is 600 pixels

For Circular form, enter the height and width, and hit create button.

Sample Image - maximum width is 600 pixels

But, the value should be less than 400 because I've set the form-size 500 X 500.
For the complete code, download the source code.


The motive of posting this article is to help those who want to create rounded forms, but they didn't get any help. I searched on the internet and didn't get any desired results (many websites have shown Rounded corners only at the upper part of the Form, i.e., only upper-left and upper-right corners. But, what about the lower part of the Form?). This project shows all the four corners of the Form rounded.


  • 18th May, 2011: Initial post
  • 19th May, 2011: Article updated - With these changes, you just have to change the value of chgcorn and all the four corners will be rounded accordingly.
  • 10th June, 2011: Article updated


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

QuestionRounded Corner Windows Forms Pin
rsmldmv17-Jun-16 8:01
Memberrsmldmv17-Jun-16 8:01 
KipkoechE11-Feb-15 6:35
MemberKipkoechE11-Feb-15 6:35 
KipkoechE11-Feb-15 6:33
MemberKipkoechE11-Feb-15 6:33 
how can i close the round form apart from using form_click event ? Form_click event is not sustainable for forms like login...
QuestionHelpful Pin
Zenu Khas30-Jun-14 6:29
MemberZenu Khas30-Jun-14 6:29 
QuestionNot useful Pin
glenda patricia sevilla27-Aug-13 20:45
Memberglenda patricia sevilla27-Aug-13 20:45 
QuestionA possible useful feature Pin
bartj6313-Aug-12 19:21
Memberbartj6313-Aug-12 19:21 
GeneralMy vote of 2 Pin
Casey Sheridan9-Jul-12 3:03
professionalCasey Sheridan9-Jul-12 3:03 
QuestionHow to get Rounded Rectangular form without listbox, just as default shape for all project forms? Pin
Member 800456027-Jul-11 22:16
MemberMember 800456027-Jul-11 22:16 
AnswerRe: How to get Rounded Rectangular form without listbox, just as default shape for all project forms? Pin
Hassanoor4-Aug-11 21:49
MemberHassanoor4-Aug-11 21:49 
GeneralNot WebForms Pin
AspDotNetDev10-Jun-11 9:51
protectorAspDotNetDev10-Jun-11 9:51 
GeneralNot very informative... Pin
Sander Rossel10-Jun-11 9:49
professionalSander Rossel10-Jun-11 9:49 
GeneralRe: Not very informative... Pin
AspDotNetDev10-Jun-11 10:03
protectorAspDotNetDev10-Jun-11 10:03 
GeneralRe: Not very informative... Pin
Sander Rossel10-Jun-11 10:18
professionalSander Rossel10-Jun-11 10:18 
GeneralMy vote of 2 Pin
Skif10-Jun-11 7:01
MemberSkif10-Jun-11 7:01 
GeneralYou should rename the title Pin
After205023-May-11 1:58
MemberAfter205023-May-11 1:58 
Generalnice Pin
BillW3318-May-11 5:24
professionalBillW3318-May-11 5:24 
GeneralAdding custom skins for Forms in VB.Net Pin
EscKey200418-May-11 3:56
MemberEscKey200418-May-11 3:56 
GeneralRe: Adding custom skins for Forms in VB.Net Pin
Ed Nutting10-Jun-11 10:53
MemberEd Nutting10-Jun-11 10:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.