First of all, I can't take full credit for this, as I borrowed this myself from somewhere, but can't remember where now.
Anywho, I've noticed quite a many request in this and other forums to figure out how to round corners of an object.
So i'm posting an Official Function that makes it very Easy.
Simply Copy & Paste the following function into your form somewhere
Round It Code:
Private Sub makeRound(ByVal vObject As Object) Dim p As New Drawing2D.GraphicsPath() p.StartFigure() p.AddArc(New Rectangle(0, 0, 20, 20), 180, 90) p.AddLine(20, 0, vObject.Width - 20, 0) p.AddArc(New Rectangle(vObject.Width - 20, 0, 20, 20), -90, 90) p.AddLine(vObject.Width, 20, vObject.Width, vObject.Height - 20) p.AddArc(New Rectangle(vObject.Width - 20, vObject.Height - 20, 20, 20), 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() vObject.Region = New Region(p) End Sub
For more of a rounded curve try replacing all of the "20"s with "40"
To make use on almost any object in a form simply:
Use It Code:
makeRound(yourObject) ' Like makeRound(TreeView1)
Tada!




Reply With Quote