title: How can I make a graphics path with more points?
body: <p>I'm creating a path that will be followed by a rectangle. I want to make it with more "tick" points, since on each timer tick I draw it on the next point on the made curve. When it reaches the curve's turn, it goes smoothly, since there are more points at the curve, but at the straight parts of the path, it skips a lot of distance to reach the next points on the list. How can I make the PathPoints with more points? Or is there a better approach to what I'm trying to do? The approach that I'm using, I found it on the internet.</p>
  
  <pre><code>    public Form1()
      {
          InitializeComponent();
  
          //avoid flickering
          this.DoubleBuffered = true;
  
          //make a bitmap to display
          _bmp = new Bitmap(100, 100);
          using (Graphics g = Graphics.FromImage(_bmp))
          {
              g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  
              g.FillRectangle(Brushes.Aquamarine, new Rectangle(_bmp.Width / 2 - 2, _bmp.Height / 2 - 2, 10, 10));
          }
  
          //cleanup
          this.FormClosing += delegate { if (_bmp != null) _bmp.Dispose(); if (_gPath != null) _gPath.Dispose(); };
  
          //setup a path and add some random values
          _gPath = new System.Drawing.Drawing2D.GraphicsPath();
  
          List&lt;Point&gt; fList = new List&lt;Point&gt;();
  
          //add points that will let the picturebox be fully visible inside the form
          Point middle = new Point(this.ClientSize.Width / 2, this.ClientSize.Height / 2);
          fList.Add(new Point(this.ClientSize.Width / 2, this.ClientSize.Height));
          fList.Add(new Point(middle.X - 20, middle.Y + 20));
          fList.Add(new Point(0, this.ClientSize.Height / 2));
          //fList.Add(new Point(this.ClientSize.Width / 2, this.ClientSize.Height / 2));
  
          //add a curve by these values
          _gPath.AddCurve(fList.ToArray());
  
          //flatten, to make the path a Path of lines and points
          _gPath.Flatten();
  
          //get these points as Array to locate the picturebox
          this._points = _gPath.PathPoints;
  
          //add the handler for the paint-event
          this.Paint += new PaintEventHandler(Form1_Paint);
  
          //start the timer
          t.Tick += new EventHandler(t_Tick);
          t.Interval = 100;
          t.Start();
          Console.WriteLine(_points.Length);
      }
  
      void Form1_Paint(object sender, PaintEventArgs e)
      {            
          if (_gPath != null &amp;&amp; _bmp != null)
          {
              //draw the image
              e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
              e.Graphics.DrawPath(Pens.Black, _gPath);
              e.Graphics.DrawImage(_bmp, (int)_points[_i].X - (_bmp.Width / 2), (int)_points[_i].Y - (_bmp.Height / 2));
          }
      }
  
      void t_Tick(object sender, EventArgs e)
      {
          t.Stop();
  
          //redraw
          this.Invalidate();
  
          _i++;
          if (_i &gt;= _points.Length)
              _i = 0;
  
          t.Start();
      }
  }
  </code></pre>