hi in winforms how to paint (fillRectangle) a single cell in TableLayoutPanel ? without using other panels please.
Asked
Active
Viewed 3,197 times
1 Answers
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
-
2Change `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