title: C# fill a cell in tableLayoutPanel on a loop
body: <p>I have a problem in this code, that show me own cell filled.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
  {
     for (int j = 0; j &lt; 4; j++)
     {
        if (j % 3 == 0)
        {
           if (e.Column == j &amp;&amp; e.Row == 1)
           {
              e.Graphics.FillRectangle(Brushes.White, e.CellBounds);
           }
        }
  
        else
        {
           if (e.Column == j &amp;&amp; e.Row == 1)
           {
              e.Graphics.FillRectangle(Brushes.Brown, e.CellBounds);
           }
        }
     }
  }
  </code></pre>
  
  <p>And here the result:
  <a href="http://prntscr.com/20e3pb" rel="nofollow">http://prntscr.com/20e3pb</a></p>