title: c# drawing, circle goes outside form
body: <p>I am trying to draw a circle within my form.
  But it is strange to me I set form width and height to a fixed number, i do the same for the circle, but the circle figure goes outside the form.        </p>
  
  <pre><code>private void Form3_Paint(object sender, PaintEventArgs e)
  {        
      this.SuspendLayout();
  
      gr = this.CreateGraphics();
      gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  
      Brush fill_circ3 = Brushes.Blue;
  
      Pen ellipse_pen = new Pen(Color.Blue);            
      ellipse_pen.Width = (float)2.0;
  
      this.Width = this.Height = 400;
      Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
      gr.DrawEllipse(ellipse_pen, rect);
  
      this.ResumeLayout();
  }
  </code></pre>
  
  <p>The 3rd and 4th parameters of the Rectangle constructor defines the size in width and height of the circle.</p>
  
  <p>See the circle I got</p>
  
  <p><a href="https://i.stack.imgur.com/yhkDn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yhkDn.png" alt="enter image description here"></a></p>
  
  <p>Why does the circle goes outside the form???! I have set form and circle sizes the same!!!</p>