圆角代码怎么写

1.用DIV+CSS写圆角代码怎么写HTML代码
<html> <head> <title>3D圆角</title> <style type=text/css> .raised{background:transparent;width:40%;} .raised h1,.raised p{margin:0 10px;} .raised h1{font-size:2em;color:#fff;} .raised p{padding-bottom:0.5em;} .raised .b1,.raised .b2,.raised .b3,.raised .b4,.raised .b1b,.raised .b2b,.raised .b3b,.raised .b4b{display:block;overflow:hidden;font-size:1px;} .raised .b1,.raised .b2,.raised .b3,.raised .b1b,.raised .b2b,.raised .b3b{height:1px;} .raised .b2{background:#ccc;border-left:1px solid #fff;border-right:1px solid #eee;} .raised .b3{background:#ccc;border-left:1px solid #fff;border-right:1px solid #ddd;} .raised .b4{background:#ccc;border-left:1px solid #fff;border-right:1px solid #aaa;} .raised .b4b{background:#ccc;border-left:1px solid #eee;border-right:1px solid #999;} .raised .b3b{background:#ccc;border-left:1px solid #ddd;border-right:1px solid #999;} .raised .b2b{background:#ccc;border-left:1px solid #aaa;border-right:1px solid #999;} .raised .b1{margin:0 5px;background:#fff;} .raised .b2, .raised .b2b{margin:0 3px;border-width:0 2px;} .raised .b3, .raised .b3b{margin:0 2px;} .raised .b4, .raised .b4b{height:2px; margin:0 1px;} .raised .b1b{margin:0 5px; background:#999;} .raised .boxcontent{display:block;background:#ccc;border-left:1px solid #fff;border-right:1px solid #999;} </STYLE> </head> <body> <div class="raised"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"> <h1>3D圆角</h1> </div> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </body> </html>
2.怎么用代码写一个圆角矩形C# protected void Page_Load(object sender, EventArgs e) { Bitmap bm = new Bitmap(800, 600); Graphics g = Graphics.FromImage(bm); g.FillRectangle(Brushes.White,new Rectangle(0,0,800,600)); FillRoundRectangle(g,Brushes.Plum,new Rectangle(100, 100, 100, 100), 8); DrawRoundRectangle(g, Pens.Yellow,new Rectangle(100, 100, 100, 100), 8); bm.Save(Response.OutputStream, ImageFormat.Jpeg); g.Dispose(); bm.Dispose(); } public static void DrawRoundRectangle(Graphics g,Pen pen,Rectangle rect, int cornerRadius) { using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) { g.DrawPath(pen, path); } } public static void FillRoundRectangle(Graphics g, Brush brush,Rectangle rect, int cornerRadius) { using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) { g.FillPath(brush, path); } } internal static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, int cornerRadius) { GraphicsPath roundedRect = new GraphicsPath(); roundedRect.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90); roundedRect.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y); roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90); roundedRect.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2); roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90); roundedRect.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom); roundedRect.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90); roundedRect.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2); roundedRect.CloseFigure(); return roundedRect; } C/C++ void add_border(int border_color, int border_width, int width, int height, char * data) { int i, j; int R1, R2; char color = (char)border_color; int out_corner_X[] = {8, 4, 3, 2, 1, 1, 0, 0, 0}; int inner_corner_X[] = {8, 8, 8, 8, 8, 5, 5, 4, 4}; border_width = 4; R1 = border_width + 4; R2 = border_width; if(width <= border_width+4 || height <= border_width+4) return ; for(i=0; i