I am dynamically adding labels to cells in a table layout panel. Only the outlines of the labels are showing (not their text or background color).
Here is the heart of the routine that formats the table layout panel and adds the labels:
tlp.Controls.Clear();
tlp.SuspendLayout();
.
.
.
int[] columnWidths = GetWidthOfColumns(tlp, nList, maxColWidth);
FormatColNRow(tlp, nList[0].Height, maxRow, columnWidths);
PutNodesInGrid(tlp, nList, columnWidths);
.
.
.
tlp.ResumeLayout();
tlp.Refresh();
tlp.Focus();
Here are the lines of code from the method that actually adds the labels to the table layout panel:
tlp.Controls.Add(n);
tlp.SetCellPosition(n, new TableLayoutPanelCellPosition(n.ContainerColumn, n.ContainerRow));
The table layout panel is in the form (not in any other container). The labels are showing in the correct cell and with the correct size, but the text and background color of each label is not showing.
Any suggestions as to what to check to find the source of this problem?