Ok, I got that to draw but how would I clear the square edges? I just need to
create a rectangle with the top two corners rounded and then fill it will a
gradient (I can do the fill part already). The background will be transparent
by default so when I draw the region and fill it the corners will be gone
already if the rectangle is rounded on top only.

This is the area that I need to convert to a region, I think, so it can be filled.

VB Code:
  1. Function BorderRect() As Rectangle
  2.         Dim rec As Rectangle = Me.cmdClose.ClientRectangle
  3.         Return New Rectangle(1, 1, rec.Width - 3, rec.Height - 3)
  4.     End Function
  5.  
  6.     Private Sub DrawRoundedButtons(ByVal g As Graphics, ByVal p As Pen, ByVal rec As Rectangle, ByVal size As Size)
  7.         Dim oldSmoothingMode As SmoothingMode = g.SmoothingMode
  8.         g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
  9.         'Top line
  10.         g.DrawLine(p, rec.Left + size.Width \ 2, rec.Top, rec.Right - size.Width \ 2, rec.Top)
  11.         'Right top corner
  12.         g.DrawArc(p, rec.Right - size.Width, rec.Top, size.Width, size.Height, 270, 90)
  13.         'Right line
  14.         g.DrawLine(p, rec.Right, rec.Top + size.Height \ 2, rec.Right, rec.Bottom)
  15.         'Bottom line
  16.         g.DrawLine(p, rec.Right, rec.Bottom, rec.Left, rec.Bottom)
  17.         'Left line
  18.         g.DrawLine(p, rec.Left, rec.Bottom, rec.Left, rec.Top + size.Height \ 2)
  19.         'Left top corner
  20.         g.DrawArc(p, rec.Left, rec.Top, size.Width, size.Height, 180, 90)
  21.         g.SmoothingMode = oldSmoothingMode
  22.     End Sub
  23.  
  24.     Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles cmdClose.Paint
  25.         DrawRoundedButtons(e.Graphics, New Pen(Color.Black), BorderRect, New Size(16, 16))
  26.     End Sub
Thanks