title: How to draw rounded rectangle with variable width border inside of specific bounds
body: <p>I have a method that draws a rounded rectangle with a border. The border can be any width, so the problem I'm having is the border is extending past the given bounds when it's thick because it's drawn from the center of a path.</p>
  
  <p>How would I include the width of the border so that it fits perfectly in the given bounds?</p>
  
  <p>Here's the code I'm using to draw the rounded rectangle.</p>
  
  <pre><code>private void DrawRoundedRectangle(Graphics gfx, Rectangle Bounds, int CornerRadius, Pen DrawPen, Color FillColor)
  {
      GraphicsPath gfxPath = new GraphicsPath();
  
      DrawPen.EndCap = DrawPen.StartCap = LineCap.Round;
  
      gfxPath.AddArc(Bounds.X, Bounds.Y, CornerRadius, CornerRadius, 180, 90);
      gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y, CornerRadius, CornerRadius, 270, 90);
      gfxPath.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
      gfxPath.AddArc(Bounds.X, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
      gfxPath.CloseAllFigures();
  
      gfx.FillPath(new SolidBrush(FillColor), gfxPath);
      gfx.DrawPath(DrawPen, gfxPath);
  }
  </code></pre>