用gdi+怎么画圆环 如题,画完圆环后,用颜色怎么填充,两边颜色一样向中间颜色线性过渡如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.Drawing.Graphics g = this.CreateGraphics(); g.DrawEllipse(new Pen(new System.Drawing.SolidBrush(Color.Black),10f),new Rectangle(new Point(0,0),new Size(50,50)));把画笔调粗点就是圆环了。 楼主,告诉你一个秘密:GDI+里面有一个路径渐变画笔下面是我的代码,仅供参考:private Bitmap MyDrawEllipse(Point StartPoint, int Size, Color SurroundColor, Color CenterColor){ Bitmap b = new Bitmap(500, 500); Graphics g = Graphics.FromImage(b); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Rectangle myRectangle = new Rectangle(StartPoint, new Size(Size, Size)); GraphicsPath path = new GraphicsPath(); path.AddEllipse(myRectangle); PathGradientBrush pthGrBrush = new PathGradientBrush(path); pthGrBrush.CenterColor = CenterColor; Color[] SurroundColors = { SurroundColor }; pthGrBrush.SurroundColors = SurroundColors; g.FillEllipse(pthGrBrush, myRectangle); //再画一遍边缘,这样圆不会看起来有毛边 g.DrawEllipse(new Pen(SurroundColor), myRectangle); return b;} ExecuteNonQuery C#中关于接口的使用 初学C#,请帮忙讲解一下程序。 如何 使按钮点下变色 怎么限定文本框只能输大写字母? 请教一个基础问题:做winform开发,当窗口大小发生改变时,最好采用什么办法定位各个控件位置?代码吗? C#委托 异步问题 如何实现不同接口中相同名字的方法? 如何获取一个文件某一段的md5值 从打开的子窗口获得返回值? 如何避免C#程序执行过程中的“未响应问题”(这个执行过程的确要等待一段时间的) 多panel的问题,帮忙解决一下
g.DrawEllipse(new Pen(new System.Drawing.SolidBrush(Color.Black),10f),new Rectangle(new Point(0,0),new Size(50,50)));把画笔调粗点就是圆环了。
下面是我的代码,仅供参考:private Bitmap MyDrawEllipse(Point StartPoint, int Size, Color SurroundColor, Color CenterColor)
{
Bitmap b = new Bitmap(500, 500);
Graphics g = Graphics.FromImage(b);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Rectangle myRectangle = new Rectangle(StartPoint, new Size(Size, Size)); GraphicsPath path = new GraphicsPath();
path.AddEllipse(myRectangle);
PathGradientBrush pthGrBrush = new PathGradientBrush(path); pthGrBrush.CenterColor = CenterColor; Color[] SurroundColors = { SurroundColor };
pthGrBrush.SurroundColors = SurroundColors; g.FillEllipse(pthGrBrush, myRectangle); //再画一遍边缘,这样圆不会看起来有毛边
g.DrawEllipse(new Pen(SurroundColor), myRectangle); return b;
}