C#圆角窗体简单实现方法
本文实例讲述了C#圆角窗体简单实现方法。分享给大家供大家参考。具体如下:
publicpartialclassForm1:Form { publicForm1() { InitializeComponent(); } privatevoidForm1_Resize(objectsender,EventArgse) { Type(this,25,0.1); } privatevoidType(Controlsender,intp_1,doublep_2) { GraphicsPathoPath=newGraphicsPath(); oPath.AddClosedCurve(newPoint[]{newPoint(0,sender.Height/p_1),newPoint(sender.Width/p_1,0),newPoint(sender.Width-sender.Width/p_1,0),newPoint(sender.Width,sender.Height/p_1),newPoint(sender.Width,sender.Height-sender.Height/p_1),newPoint(sender.Width-sender.Width/p_1,sender.Height),newPoint(sender.Width/p_1,sender.Height),newPoint(0,sender.Height-sender.Height/p_1)},(float)p_2); sender.Region=newRegion(oPath); } privatevoidForm1_Paint(objectsender,PaintEventArgse) { Type(this,25,0.1); } }
希望本文所述对大家的C#程序设计有所帮助。