Option Strict-compliant, safer, and more customizable version:
P.S. radius should actually be diameter.Code:Private Sub MakeRound(ByVal c As Control, Optional ByVal radius As Integer = 20) Dim p As New Drawing2D.GraphicsPath() p.AddArc(New Rectangle(0, 0, radius, radius), 180, 90) p.AddLine(20, 0, vObject.Width - 20, 0) p.AddArc(New Rectangle(vObject.Width - radius, 0, radius, radius), -90, 90) p.AddLine(vObject.Width, 20, vObject.Width, vObject.Height - radius) p.AddArc(New Rectangle(vObject.Width - radius, vObject.Height - radius, radius, radius), 0, 90) p.AddLine(vObject.Width - 20, vObject.Height, 20, vObject.Height) p.AddArc(New Rectangle(0, vObject.Height - 20, 20, 20), 90, 90) p.CloseFigure() c.Region = New Region(p) End Sub




Reply With Quote