Imports System.Drawing
Imports System.Drawing.Drawing2D


Public Class MYGDI

    Public Shared Function GetRoundedRectPath(ByVal rect As Rectangle, ByVal radius As Integer) As GraphicsPath

        Dim diameter As Integer = 2 * radius
        Dim arcRect As New Rectangle(rect.Location, New Size(diameter, diameter))
        Dim path As GraphicsPath = New GraphicsPath()
        path.AddArc(arcRect, 180, 90)

        arcRect.X = rect.Right - diameter
        path.AddArc(arcRect, 270, 90)

        arcRect.Y = rect.Bottom - diameter
        path.AddArc(arcRect, 0, 90)

        arcRect.X = rect.Left
        path.AddArc(arcRect, 90, 90)

        path.CloseFigure()

        Return path
    End Function




End Class
