给你个效果比较好的:
private void Type(Control sender,int p_1,double p_2)
{
GraphicsPath oPath = new GraphicsPath();
oPath.AddClosedCurve(new Point[] {new Point(0,sender.Height / p_1),new Point(sender.Width / p_1,0),new Point(sender.Width - sender.Width / p_1,0),new Point(sender.Width,sender.Height / p_1),new Point(sender.Width,sender.Height - sender.Height / p_1),new Point(sender.Width - sender.Width / p_1,sender.Height),new Point(sender.Width / p_1,sender.Height),new Point(0,sender.Height - sender.Height / p_1)},(float)p_2);
sender.Region = new Region(oPath);
}
如果是窗体则在paint和resize事件中增加:Type(this,20,0.1);
private void Type(Control sender,int p_1,double p_2)
{
GraphicsPath oPath = new GraphicsPath();
oPath.AddClosedCurve(new Point[] {new Point(0,sender.Height / p_1),new Point(sender.Width / p_1,0),new Point(sender.Width - sender.Width / p_1,0),new Point(sender.Width,sender.Height / p_1),new Point(sender.Width,sender.Height - sender.Height / p_1),new Point(sender.Width - sender.Width / p_1,sender.Height),new Point(sender.Width / p_1,sender.Height),new Point(0,sender.Height - sender.Height / p_1)},(float)p_2);
sender.Region = new Region(oPath);
}
如果是窗体则在paint和resize事件中增加:Type(this,20,0.1);