Public Class Form1
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim butarray() As Button = Nothing
Dim list As New List(Of Button)
For Each button As Button In Me.Controls
list.Add(button)
Next
RoundButton(list.ToArray)
End Sub
Private Sub RoundButton(btn() As Button)
For Each bt In btn
bt.FlatStyle = FlatStyle.Flat
bt.FlatAppearance.BorderSize = 0
bt.BackColor = Color.Red
bt.ForeColor = Color.White
bt.Cursor = Cursors.Hand
bt.Font = New Font("Century Gothic", 14)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
'appends an elliptical arc to the current figure
'left corner top
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
'appends a line segment to the current figure
Raduis.AddLine(10, 0, bt.Width - 20, 0)
'appends an elliptical arc to the current figure
'right corner top
Raduis.AddArc(New Rectangle(bt.Width - 20, 0, 20, 20), -90, 90)
'appends a line segment to the current figure
Raduis.AddLine(bt.Width, 20, bt.Width, bt.Height - 10)
'appends an elliptical arc to the current figure
'right corner buttom
Raduis.AddArc(New Rectangle(bt.Width - 25, bt.Height - 25, 25, 25), 0, 90)
'appends a line segment to the current figure
'left corner bottom
Raduis.AddLine(bt.Width - 10, bt.Width, 20, bt.Height)
'appends an elliptical arc to the current figure
Raduis.AddArc(New Rectangle(0, bt.Height - 20, 20, 20), 90, 90)
'Close the current figure and start a new one.
Raduis.CloseFigure()
'set the window associated with the control
bt.Region = New Region(Raduis)
Next
End Sub
End Class