我从网上找的设置,圆角窗体的代码,最后的结果的确圆角了,但四个圆角的弧度不一样呀,什么原因呀?我眼睛的问题?还是?   //设置圆角
        private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
        {
            int diameter = radius;
            Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
            GraphicsPath path = new GraphicsPath();
            //   左上角  
            path.AddArc(arcRect, 180, 90);
            //   右上角  
            arcRect.X = rect.Right - diameter;
            path.AddArc(arcRect, 270, 90);
            //   右下角  
            arcRect.Y = rect.Bottom - diameter;
            path.AddArc(arcRect, 0, 90);
            //   左下角  
            arcRect.X = rect.Left;
            path.AddArc(arcRect, 90, 90);
            path.CloseFigure();
            return path;
        }
        public void SetWindowRegion()
        {
            System.Drawing.Drawing2D.GraphicsPath FormPath;
            FormPath = new System.Drawing.Drawing2D.GraphicsPath();
            Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);//this.Left-10,this.Top-10,this.Width-10,this.Height-10);                
            FormPath = GetRoundedRectPath(rect, 10);
            this.Region = new Region(FormPath);
        }
        //结束如果这个不行,那还有没有更好的办法呢?研究一下午了,始终没搞明白,

解决方案 »

  1.   

    我是win2003系统?这个也分系统???如果分系统?怎么做个万能的呀?
      

  2.   

    CSDN告诉我
    每天回帖即可获得10分可用分!
      

  3.   

    FormPath = GetRoundedRectPath(rect, 90);
    把第二个参数设置大点,看到的效果就要好些了。
    不过这个做出来的效果真的有点难看。
      

  4.   

    怎么个意思?有其他的方法吗?比如API的方法?或者......
      

  5.   

    AddArc就是画弧的API,比你手工自己写肯定高效。
    没时间测你代码,如果效果不理想,请尝试调整某些参数~
      

  6.   

    没人回答我就把csdn论坛程序顶坏,死循环为纸