title: Rounded Rectangle Not Accurate
body: <p>Every sample code I've ever found for drawing rounded rectangles using GDI+ goes something like this (lifted and slightly modified from BobPowell.net):</p>
  
  <pre><code>  Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Panel1.Paint
      e.Graphics.Clear(SystemColors.Window)
      e.Graphics.SmoothingMode = SmoothingMode.None
  
      Call DrawRoundRect(e.Graphics, Pens.Red, 10, 10, 48, 24, 6)
    End Sub
  
    Public Sub DrawRoundRect(ByVal g As Graphics, ByVal p As Pen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal radius As Single)
      Using gp As New GraphicsPath()
        gp.StartFigure()
        gp.AddArc(x + width - radius, y, radius * 2, radius * 2, 270, 90)
        gp.AddArc(x + width - radius, y + height - radius, radius * 2, radius * 2, 0, 90)
        gp.AddArc(x, y + height - radius, radius * 2, radius * 2, 90, 90)
        gp.AddArc(x, y, radius * 2, radius * 2, 180, 90)
        gp.CloseFigure()
        g.DrawPath(p, gp)
      End Using
    End Sub
  </code></pre>
  
  <p>This produces a rounded rectangle where only the top left corner is accurate.</p>
  
  <p>AntiAliasing has to be turned off because it is going through a remote desktop connection, and I can't depend on it being available.  Besides, I am looking for a crisp rounded rectangle.</p>
  
  <p><img src="https://i.stack.imgur.com/OA4Z2.png" alt="enter image description here"></p>
  
  <p>I've tried resizing the other corners and changing the pen alignments, but nothing seems to produce a simple, accurate rounded rectangle.</p>
  
  <p>Is there a way to draw a better rounded rectangle than this in good old winforms?</p>