title: To avoid flickering in my code
body: <p>I m drawing rectangle on mouse move in c#,</p>
  
  <p>i wrote the code like this,</p>
  
  <h2>onmousemove:</h2>
  
  <pre><code>Rectangle rect = new Rectangle(
      Math.Min(mouseMovePoint.X, mouseDownPoint.X), 
      Math.Min(mouseMovePoint.Y, mouseDownPoint.Y),
      Math.Abs(mouseMovePoint.X - mouseDownPoint.X), 
      Math.Abs(mouseMovePoint.Y - mouseDownPoint.Y)
  );
  
      graphics.DrawRectangle(myPen, rect);
  </code></pre>
  
  <h2>onmouseup:</h2>
  
  <pre><code>this.Refresh();
  
  Rectangle rect = new Rectangle(
      Math.Min(mouseMovePoint.X, mouseDownPoint.X), 
      Math.Min(mouseMovePoint.Y, mouseDownPoint.Y),
      Math.Abs(mouseMovePoint.X - mouseDownPoint.X), 
      Math.Abs(mouseMovePoint.Y - mouseDownPoint.Y)
  );
  
  graphics.DrawRectangle(myPen, rect);
  </code></pre>
  
  <p>But due to this refresh method when i draw the rectangle it appears like as if it s flickering how to avoid that?</p>