title: How to draw in picturebox so drawing doesn't disappear?
body: <p>I saw a similar question <a href="https://stackoverflow.com/questions/4593290/how-to-draw-on-control-so-drawing-doesnt-disappear">here</a></p>
  
  <p>but I don't understand how to solve my problem though. When I move, minimize or cover the form's window, draws disappear.</p>
  
  <p>There is part of my code:</p>
  
  <pre><code>private void timer1_Tick(object sender, EventArgs e) {
  Pen pen = new Pen(Color.Red, 2);
  Pen pen2 = new Pen(Color.Green, 2);
  long i; //this value changes each tick and is set by another method
  
  picturebox1.CreateGraphics().DrawLine(pen, 0 + i, 0, 0 + i, 10); 
  picturebox1.CreateGraphics().DrawLine(pen2, 0 + ((i*2)/1.2), 0, 0 + ((i*2)/1.2), 50); }
  </code></pre>
  
  <p>I need the code is in <code>timer1_Tick()</code> method because it must draws at each tick.
  Am I using the <code>OnPaint()</code> method and its override? If yes, how to do it in my scenario?</p>