如何在c#Winform中以以下形状绘制TabControl?

如何在c#Winform中以以下形状绘制TabControl?,c#,winforms,C#,Winforms,如何在c#Winform中以以下形状绘制TabControl 我在TabControl Paint中尝试了此代码 protected override void OnPaint(PaintEventArgs pe) { using (var p = new GraphicsPath()) { p.AddPolygon(new Point[] { new Point(this.Width, 0),

如何在c#Winform中以以下形状绘制TabControl

我在TabControl Paint中尝试了此代码

protected override void OnPaint(PaintEventArgs pe)
    {
        using (var p = new GraphicsPath())
        {
            p.AddPolygon(new Point[] {
            new Point(this.Width, 0), 
            new Point(0, 0),
            new Point(0, Height), 
            new Point(Width - 5, Height),
            new Point(Width, Height -5)
            });

            this.Region = new Region(p);
            base.OnPaint(pe);
        }
    }

它不起作用,所以我在TabPage Paint事件中也尝试了相同的解决方案,但两种解决方案都不起作用。

您的代码运行良好。。。但不适用于
TabControl
。我不知道为什么


作为一种解决方法,我建议您将
TabControl
放在
UserControl
中,并将代码移动到
UserControl

使用Region属性。尝试但未工作您确实覆盖了TabControl控件?TabControl仅允许您绘制选项卡。