做网站一个月多少钱,专业建站推荐,wordpress超级留言板路径,网站关键词免费优化winform 给窗体四个角添加圆角效果。 在窗体 Load 事件中添加如下代码#xff1a;
// 创建了一个圆角矩形的路径#xff0c;并将其设置为控件的形状
System.Drawing.Drawing2D.GraphicsPath path new System.Drawing.Drawing2D.GraphicsPath();
int radius 30;
path.AddAr…winform 给窗体四个角添加圆角效果。 在窗体 Load 事件中添加如下代码
// 创建了一个圆角矩形的路径并将其设置为控件的形状
System.Drawing.Drawing2D.GraphicsPath path new System.Drawing.Drawing2D.GraphicsPath();
int radius 30;
path.AddArc(0, 0, radius, radius, 180, 90); // 左上角
path.AddArc(this.Width - radius, 0, radius, radius, 270, 90); // 右上角
path.AddArc(this.Width - radius, this.Height - radius, radius, radius, 0, 90); // 右下角
path.AddArc(0, this.Height - radius, radius, radius, 90, 90); // 左下角
this.Region new System.Drawing.Region(path);运行程序查看效果。四个角都有 30 大小的圆角效果。