谢谢大家
程序代码:
//设置控件的Region private void SetRegion() { if (base.Region != null) { base.Region.Dispose(); } base.Region = new Region(GetPath(ClientRectangle,6)); } //下面这个是圆角框,你可以把路径改为圆形 private GraphicsPath GetPath(Rectangle rect,int radio) { GraphicsPath path = new GraphicsPath(); path.AddArc(rect.X,rect.Y,radio,radio,180,90); path.AddArc(rect.Right - radio, rect.Y, radio, radio, 270, 90); path.AddArc(rect.Right-radio,rect.Bottom-radio,radio,radio,0,90); path.AddArc(rect.X, rect.Bottom - radio, radio, radio, 90, 90); path.CloseFigure(); return path; }