ZKX's LAB

graphics 画圆角矩形 1、java编程画一个矩形,一个是普通的未填充的矩形,一个是圆角为20像素的填充矩形。

2021-04-03知识1

怎么用代码写一个圆角矩形? 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);。

cdr如何用形状工具给矩形倒圆角?打开软件,在工具那里点击配形工具,画个矩形,大小颜色自己定,具体如下:1:打开CorelDRAW X4软件,并且点击左:-倒圆角,cdr,矩形,何用

Java的Graphics类应该怎么用?10!drawString(\".awt;import java;Hello World\",开始有Java。非常感谢。结果我按照老师给的程序运行,却警告The serializable class hello4。

#graphics 画圆角矩形

随机阅读

qrcode
访问手机版