如何制作非矩形Winforms?

我使用下面的代码来改变winform的形状。 它改变了形状,但不像我想要的那样。 我需要表格有弯角。

我应该用它来得到它?

public void MakeNonRectangularForm() { System.Drawing.Drawing2D.GraphicsPath p = new System.Drawing.Drawing2D.GraphicsPath(); int width = this.ClientSize.Width; int height = this.ClientSize.Height; p.AddClosedCurve(new Point[]{new Point(width/2, height/2), new Point(width,0), new Point(width, height/3), new Point(width-width/3, height), new Point(width/7, height-height/8)}); this.Region = new Region(p); } 

以下是我之前用于创建圆边的一些代码,使用AddArc和线将边框拼凑在一起:

(您可以使用xRadiusyRadius来实现所需的“舍入”量)

 int xRadius = {insert value here}; int yRadius = {insert value here}; GraphicsPath edge = new GraphicsPath(); int rightHandLeft = this.Width - xRadius - 1; int bottomSideTop = this.Height - yRadius - 1; edge.AddArc(0, 0, xRadius, yRadius, 180, 90); edge.AddLine(xRadius, 0, rightHandLeft, 0); edge.AddArc(rightHandLeft, 0, xRadius, yRadius, 270, 90); edge.AddLine(this.Width, yRadius, this.Width, bottomSideTop); edge.AddArc(rightHandLeft, bottomSideTop, xRadius, yRadius, 0, 90); edge.AddLine(rightHandLeft, this.Height, xRadius, this.Height); edge.AddArc(0, bottomSideTop, xRadius, yRadius, 90, 90); edge.AddLine(0, bottomSideTop, 0, yRadius); this.Region = new Region(edge);