Как отрисовать скругленные края у прямоугольника? C#

У меня имеется данный код:

for (int i = 0; i <= base.TabCount - 1; i++)
{
    Rectangle rectangle = new Rectangle(new Point(base.GetTabRect(i).Location.X + 2, base.GetTabRect(i).Location.Y), new Size(base.GetTabRect(i).Width, base.GetTabRect(i).Height));
    Rectangle rectangle2 = new Rectangle(rectangle.Location, new Size(rectangle.Width, rectangle.Height));

    Brush brush = new SolidBrush(this.closingButtonColor);
    e.Graphics.DrawImage(Properties.Resources.close_idle, (float)(rectangle2.Right - 18), 3, 12, 12);
    bool flag = i == base.SelectedIndex;
    if (flag)
    {
        graphics2.FillRectangle(new SolidBrush(this.headerColor), rectangle2);
        graphics2.FillRectangle(new SolidBrush(this.activeColor), new Rectangle(rectangle.X - 5, rectangle.Y - 3, rectangle.Width, rectangle.Height + 5));
        graphics2.DrawString(base.TabPages[i].Text, this.Font, new SolidBrush(this.selectedTextColor), rectangle2, this.CenterSringFormat);
        bool showClosingButton = this.ShowClosingButton;
        if (showClosingButton)
        {
            e.Graphics.DrawImage(Properties.Resources.close_selected, (float)(rectangle2.Right - 18), 3, 12 ,12);

        }
    }
    else
    {
        graphics2.DrawString(base.TabPages[i].Text, this.Font, new SolidBrush(this.textColor), rectangle2, this.CenterSringFormat);
    }
}

graphics2.DrawLine(new Pen(this.horizLineColor, 5f), new Point(0, 19), new Point(base.Width, 19));
graphics2.FillRectangle(new SolidBrush(this.backTabColor), new Rectangle(0, 20, base.Width, base.Height - 20));
graphics2.DrawRectangle(new Pen(this.borderColor, 2f), new Rectangle(0, 0, base.Width, base.Height));
graphics2.InterpolationMode = InterpolationMode.HighQualityBicubic;

Тут края не скругленные и выглядят так - введите сюда описание изображения

Уже очень долго ломаю голову, как мне отрисовать круглые края.

Пример круглых краев - введите сюда описание изображения


Ответы (0 шт):