`

C# 窗体圆角制作

 
阅读更多

using   System.Drawing.Drawing2D;

protected   override   void   OnPaint(   System.Windows.Forms.PaintEventArgs   e   )      
 {       
GraphicsPath   oPath   =   new   GraphicsPath();       
int   x=0;       
int   y=0;       
int   w=Width;       
int   h=Height;       
int   a=40;       
Graphics   g=CreateGraphics();       
oPath.AddArc(x,y,a,a,180,90);       
oPath.AddArc(w-a,y,a,a,270,90);       
oPath.AddArc(w-a/2,h-a/2,a/2,a/2,0,90);       
oPath.AddArc(x,h-a,a,a,90,90);       
oPath.CloseAllFigures();       
Region=new   Region(oPath);      
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics