圆角Button 在C#(WinForm)中怎样做四个角都是圆角的Button,就像google中的搜索按钮一样?谢谢大家了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Google的按钮?http://www.google.com/?那个不是个标准按钮么? 你去www.codeproject.com找找例如:http://www.codeproject.com/cs/miscctrl/zhaocolorbutton.asp 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就是所需的圆角矩形。 可以用css 然后套用图片 按钮就会和 你的图片一个形状了! 遇到了问题关于axwebbrowser C# 用vs2005制作的安装包问题? C#如何传值给textbox(MySql数据库) 帮忙看个程序.不明白的地方在程序中注释了出来,高手解惑. 请懂得 ActiveX 控件问题的高手回答-- 有关 ActiveX 控件激活问题(winForm) winform 中listbox该怎么用 C#和C++区别有多大? 能够从类的名字的到类的类型么。 怎样和access数据库连接? 循环执行多个SQL脚本文件,在执行第2个时报错 30岁的程序员,怎么办 C#如何生成本地化的非托管代码(不再依赖CLR的应用程序)高人请指教,谢谢!
http://www.google.com/?
那个不是个标准按钮么?
例如:
http://www.codeproject.com/cs/miscctrl/zhaocolorbutton.asp
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就是所需的圆角矩形。