在C#(WinForm)中怎样做四个角都是圆角的Button,就像google中的搜索按钮一样?谢谢大家了.

解决方案 »

  1.   

    Google的按钮?
    http://www.google.com/?
    那个不是个标准按钮么?
      

  2.   

    你去www.codeproject.com找找
    例如:
    http://www.codeproject.com/cs/miscctrl/zhaocolorbutton.asp
      

  3.   

    GraphicsPath GetRoundedRectPath(Rectangle rect, int radius) {
                int diameter = 2 * 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;
            }
    调用的时候先new一个矩形,这个矩形就是你要变为圆角矩形的那个。比如:
                Rectangle rect = new Rectangle(10, 10, width - 20, height - 20);
                GraphicsPath path = GetRoundedRectPath(rect, width/10);
    最后path就是所需的圆角矩形。
      

  4.   

    可以用css 然后套用图片 按钮就会和 你的图片一个形状了!