button round corners

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
hi

I want a round corner of the button

The following code was used and succeeded in 3 round corner

The fourth angle has a distortion as the picture

BOTTOM LEFT CORNER error


1418989.png

Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
On Error Resume Next
Dim p As New System.Drawing.Drawing2D.GraphicsPath
p.StartFigure()
'TOP LEFT CORNER
p.AddArc(New Rectangle(-1, -1, 10, 10), 180, 90)
p.AddLine(40, 0, Button1.Width - 10, 0)
' TOP RIGHT CORNER
p.AddArc(New Rectangle(Button1.Width - 10, -1, 10, 10), -90, 90)
p.AddLine(Button1.Width, 40, Button1.Width, Button1.Height - 10)
' BOTTOM RIGHT CORNER
p.AddArc(New Rectangle(Button1.Width - 10, Button1.Height - 10, 10, 10), 0, 90)
p.AddLine(Button1.Width - 10, Button1.Height, 10, Button1.Height)

'error
'BOTTOM LEFT CORNER
p.AddArc(New Rectangle(0, Button1.Height - 8, 9, 8), 90, 90)
p.CloseFigure()
Button1.Region = New Region(p)
p.CloseAllFigures()
p.Dispose()
End Sub

Continue reading...
 
Back
Top