2

hi in winforms how to paint (fillRectangle) a single cell in TableLayoutPanel ? without using other panels please.

gooteis
  • 57
  • 1
  • 6

1 Answers1

7

You have to subscribe to the CellPaint event. As an example:

    private void tableLayoutPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
    {
        if (e.Row == 0 && e.Column == 1)
        {
            e.Graphics.FillRectangle(new SolidBrush(Color.Black), e.CellBounds);
        }
    }
ba__friend
  • 5,783
  • 2
  • 27
  • 20
  • 2
    Change `e.ClipRectangle` to `e.CellBounds` and this will be the right answer ;) (ClipRectangle refers to the whole panel) – digEmAll May 17 '11 at 13:19