title: select two point to Draw a circle
body: <p>I am using visual studio c# windows form, I need help to draw a circle using the Mouse click.. first click will give me the center of the circle equal to the cursor position and the second click will give me a point on the border of the circle equal to the second position of the cursor, the distance between the to points will give me the radius..now I have radius and point ..I can draw a circle ..The code doesn't work because I only can get one position of the cursor no matter how many times I click the mouse</p>
  
  <pre><code>private void Form1_MouseDown(object sender, MouseEventArgs e)
      {
          int lastX = Cursor.Position.X;//the first click x cursor position
          int lastY = Cursor.Position.Y;//the first click y cursor  position,         
  
     //is there any way to reuse the Cursor.Position for different point ??
     int x = Cursor.Position.X;//the second click x cursor position
          int y = Cursor.Position.Y;//the second click y cursor  position
          Graphics g;
         double oradius=Math.Sqrt(((lastX-x)^2) +((lastY-y)^2));
          //double newy = Math.Sqrt(lastY);
         // int newxv = Convert.ToInt32(newx);
          int radius= Convert.ToInt32(oradius);
          g = this.CreateGraphics();
  
          Rectangle rectangle = new Rectangle();
          PaintEventArgs arg = new PaintEventArgs(g, rectangle);
  
          DrawCircle(arg, x, y,radius,radius);
      }
  
  
      private void DrawCircle(PaintEventArgs e, int x, int y, int width, int height)
      {
          System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Red, 3);
          e.Graphics.DrawEllipse(pen, x - width / 2, y - height / 2, width, height);
      }
  }
  </code></pre>