I would like to draw a rectangle with rounded edges.
The "roundness" should stay consistent, no matter which size (except a minimum size of let's say 50x50 pixels) the rectangle has.
My current approach looks like the one below. It doesn't take the size of the rectangle into account. I use 45 as the arcsize.
How could I make the roundness consistent over different rectangle sizes?
Thank you.
Public Function RoundedRect(ByVal uRect As Rectangle, ByVal uArchSize As Integer) As GraphicsPath
Dim nPath As New GraphicsPath
If uArchSize > 0 Then
nPath.AddArc(Rectangle.FromLTRB(uRect.Right - uArchSize, uRect.Top, uRect.Right, uRect.Top + uArchSize), -90, 90)
nPath.AddArc(Rectangle.FromLTRB(uRect.Right - uArchSize, uRect.Bottom - uArchSize, uRect.Right, uRect.Bottom), 0, 90)
nPath.AddArc(Rectangle.FromLTRB(uRect.Left, uRect.Bottom - uArchSize, uRect.Left + uArchSize, uRect.Bottom), 90, 90)
nPath.AddArc(Rectangle.FromLTRB(uRect.Left, uRect.Top, uRect.Left + uArchSize, uRect.Top + uArchSize), 180, 90)
nPath.CloseFigure()
Else
nPath.AddRectangle(uRect)
End If
Return nPath
End Function