C# 线性渐变圆

C# 线性渐变圆 C# 线性渐变圆 C# 线性渐变圆 C# 线性渐变圆 

 Thread t = new Thread(() =>
            {
                for (int i = 0; i < 360; i++)
                {
                    Thread.Sleep(100);
                    double dblsin = Math.Sin(Math.PI * (i + 1) / 180);
                    double dblcos = Math.Cos(Math.PI * (i + 1) / 180);
                    int y = 100 + Convert.ToInt32(Math.Floor(50 * dblsin));
                    int x = 100 + Convert.ToInt32(Math.Floor(50 * dblcos));
                    Point p1 = new Point(x, y);

                    double dblsin2 = Math.Sin(Math.PI * (180 + (i + 1)) / 180);
                    double dblcos2 = Math.Cos(Math.PI * (180 + (i + 1)) / 180);
                    int y2 = 100 + Convert.ToInt32(Math.Floor(50 * dblsin2));
                    int x2 = 100 + Convert.ToInt32(Math.Floor(50 * dblcos2));
                    Point p2 = new Point(x2, y2);

                    using (Brush aGradientBrush = new LinearGradientBrush(p1, p2, Color.Blue, Color.White))
                    { 
                        using (Pen aGradientPen = new Pen(aGradientBrush, 1))
                        { 
                            g.DrawLine(aGradientPen, p1, p2);
                        }
                    }
                }
            });
            t.Start();

 

 

C# 线性渐变圆

上一篇:c#使用websocket


下一篇:C#在服务器中记录日志的方法【简单】