圆形画怎么样添字电脑图标(C# 绘制十字架图标(WinForm)加号图案)
绘制十字图标:用户自定义控件
protectedoverridevoidOnPaint(PaintEventArgse){base.OnPaint(e);Graphicsg=e.Graphics;g.SmoothingMode=SmoothingMode.AntiAlias;intwidth=this.Width;intheight=this.Height;//绘制圆形intcircleDiameter=Math.Min(width,height)-60;//外圆缩小10个像素intcircleX=(width-circleDiameter)/2;intcircleY=(height-circleDiameter)/2;RectanglecircleRect=newRectangle(circleX,circleY,circleDiameter,circleDiameter);using(PencirclePen=newPen(Color.Red,39)){g.DrawEllipse(circlePen,circleRect);}using(BrushcircleBrush=newSolidBrush(Color.Green)){g.FillEllipse(circleBrush,circleRect);//填充圆形}//绘制十字图标intcrossSize=circleDiameter/2;intcrossX=(width-crossSize)/2;intcrossY=(height-crossSize)/2;RectanglecrossRect=newRectangle(crossX,crossY,crossSize,crossSize);using(PencrossPen=newPen(Color.Red,59)){inthalfLineWidth=(int)crossPen.Width/2;g.DrawLine(crossPen,crossRect.Left-halfLineWidth,crossRect.Top+crossRect.Height/2,crossRect.Left+crossRect.Width+halfLineWidth,crossRect.Top+crossRect.Height/2);//绘制横线g.DrawLine(crossPen,crossRect.Left+crossRect.Width/2,crossRect.Top-halfLineWidth,crossRect.Left+crossRect.Width/2,crossRect.Top+crossRect.Height+halfLineWidth);//绘制竖线}}
#头条文章养成计划##夏日生话打卡季##头条家时光#