`
qqjavagood
  • 浏览: 95345 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论
阅读更多
    <p>本文转自:<font><a href="http://blog.csdn.net/terry001/archive/2008/05/01/2352511.aspx" target="_blank">http://blog.csdn.net/terry001/archive/2008/05/01/2352511.aspx</a></font></p><p>public  void  setwindowregion()   <br> {   <br> system.drawing.drawing2d.graphicspath  formpath;   <br> formpath  =  new  system.drawing.drawing2d.graphicspath();   <br> rectangle  rect=new  rectangle(0,22,this.width,this.height-22);//this.left-10,this.top-10,this.width-10,this.height-10);         <br> formpath  =  getroundedrectpath(rect,  30);  <br> this.region  =  new  region(formpath);   <br> }  <br> private  graphicspath  getroundedrectpath(rectangle  rect,  int  radius)   <br> {  <br> int  diameter  =  radius;  <br> rectangle  arcrect  =  new  rectangle(rect.location,  new  size(diameter,  diameter));  <br> graphicspath  path  =  new  graphicspath();  <br> //  左上角  <br> path.addarc(arcrect,  180,  90);  <br> //  右上角  <br> arcrect.x  =  rect.right  -  diameter;  <br> path.addarc(arcrect,  270,  90);  <br> //  右下角  <br> arcrect.y  =  rect.bottom  -  diameter;  <br> path.addarc(arcrect,  0,  90);  <br> //  左下角  <br> arcrect.x  =  rect.left;  <br> path.addarc(arcrect,  90,  90);  <br> path.closefigure();  <br> return  path;  <br> }  <br> protected  override  void  onresize(system.eventargs  e)   <br> {   <br> this.region  =  null;   <br> setwindowregion();   <br> }</p> 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics