title: Mouse Drag - C# bot
body: <p>First time doing this. I am currently building a bot using C# and want my bot to be able to move the mouse to a given point in a way that looks human. By this I am referring to the dragging of the mouse when a human moves the cursor to a point they are trying to click on. Currently my C# bot moves the mouse instantly to the location which doesn't look human.  </p>
  
  <pre><code>private static Point[] FindColor(Color color)
  {
      int searchValue = color.ToArgb();
      List&lt;Point&gt; result = new List&lt;Point&gt;();
      using (Bitmap bmp = GetScreenShot())
      {
          for (int x = 0; x &lt; bmp.Width; x++)
          {
              for (int y = 0; y &lt; bmp.Height; y++)
              {
                  if (searchValue.Equals(bmp.GetPixel(x, y).ToArgb()))
                      result.Add(new Point(x, y));
              }
          }
      }
      return result.ToArray();
  }
  
  
  // FUNCTIONS OCCUR BELOW
  // Error message if program could not find bitmap within screenshot show error message
  
  Color myRgbColor = new Color(); // Creates new colour called myRgbColor
  myRgbColor = Color.FromArgb(51, 90, 9); // This colour equals the RGB value
  Point[] points = FindColor(myRgbColor); // Create an array called points which list all the points found in the screen where the RgB value matches.
  if (points.Length &gt; 0)
  {
      Cursor.Position = points[2]; // Move mouse cursor to first point (Point 0)
      Thread.Sleep(0200);
      MouseClick();
  }
  if (points.Length == 0)
  {
      MessageBox.Show("No matches!"); // Return error
      goto checkore;
  }
  </code></pre>