实现Winfrom RichTextbox四个角为圆角的代码
时间: 2023-04-06 16:03:19 浏览: 98
代码实现圆角Textview
以下是实现Winform RichTextBox四个角为圆角的代码:
private void Form1_Load(object sender, EventArgs e)
{
// 设置圆角
GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddArc(new Rectangle(0, 0, 20, 20), 180, 90);
path.AddLine(20, 0, this.Width - 20, 0);
path.AddArc(new Rectangle(this.Width - 20, 0, 20, 20), -90, 90);
path.AddLine(this.Width, 20, this.Width, this.Height - 20);
path.AddArc(new Rectangle(this.Width - 20, this.Height - 20, 20, 20), 0, 90);
path.AddLine(this.Width - 20, this.Height, 20, this.Height);
path.AddArc(new Rectangle(0, this.Height - 20, 20, 20), 90, 90);
path.CloseFigure();
this.Region = new Region(path);
}
希望能够帮到您。
阅读全文