title: C# Drawing on panel in TLP
body: <pre><code>private void panel1_Paint(object sender, PaintEventArgs e)
   {
    Graphics graphicObj;
    graphicObj = this.CreateGraphics();
    Pen myPen = new Pen(System.Drawing.Color.Black, 2);
  
    graphicObj.DrawEllipse(myPen, 200, 200, 200, 200);
   }
  </code></pre>
  
  <p>This work on form. But for auto resizing items such as buttons, label I have to use TablePanelLayout, and drawing on it only works with adding to construtor in form</p>
  
  <pre><code>panel1.Paint+=new PaintEventHandler(panel1_draw);
  </code></pre>
  
  <p>and then by drawing with this method</p>
  
  <pre><code>private void panel1_Paint(object sender, PaintEventArgs e)
  {
      var g = e.Graphics;
      Pen myp = new Pen(System.Drawing.Color.Red, 4);
      Font fy = new Font("Helvetica", 10, FontStyle.Bold);
      Brush br = new SolidBrush(System.Drawing.Color.Red);
      g.DrawString(textBox1.Text, fy, br, 0,0);
  }
  </code></pre>
  
  <p>Question is Why/what topic should I master to know it.</p>