title: Run function every second Visual C#
body: <p>I have problems with timer.
  I have function in function (draw in func)</p>
  
  <pre><code>void func(){
  
   /*...do something ... */
  for(){
     for() {
    /*loop*/
  
   draw(A,B, Pen);
  
   }
  
  /*... do something ...*/
    }
  }
  </code></pre>
  
  <p>This is draw function</p>
  
  <pre><code>   public void draw1(Point Poc, Point Kra, Pen o) {
        Graphics g = this.CreateGraphics();
        g.DrawLine(o,Poc.X+4, Poc.Y+4,Kra.X+4, Kra.Y+4);
        g.Dispose();
        }
  </code></pre>
  
  <p>I call function 'func' on button click</p>
  
  <pre><code>private void button4_Click(object sender, EventArgs e){
  
      func();
  
  }
  </code></pre>
  
  <p>I want to call draw function evry second (draw the line every second). 
  Between drawings, function needs to continue working and calculate = loop, and draw next line for some time(interval). I tried with </p>
  
  <pre><code>timer1.Tick += new EventHandler(timer1_Tick);
  </code></pre>
  
  <p>etc..</p>
  
  <pre><code>private void timer1_Tick(object sender, EventArgs e)
      {
          ...
          draw(A, B, Pen)
      }
  </code></pre>
  
  <p>etc..</p>
  
  <p>but all that stops my function, and draw one random line.
  I just want the time(interval) between two drawings in function 'func'. Without timer works fine, but draw all lines immediately, I need slow drawing. 
  Cheers.</p>