如题,画完圆环后,用颜色怎么填充,两边颜色一样
向中间颜色线性过渡
如何实现?

解决方案 »

  1.   

                    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)));把画笔调粗点就是圆环了。
      

  2.   

    楼主,告诉你一个秘密: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;
    }