enable to redraw inner control

morfix78's Avatar
Go4Expert Member
Hello,
I have a control which inherits from a TableLayoutPanel.
I add to this control a panel using the Controls.Add function.
when i try to change in run time the background of the panel which i added to the TableLayoutPanel the background stays the same a does not change.
can someone knows why?
thanks.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
How are you changing the panel background and does the code in the TableLayoutPanel allows to custom paint the child controls. Can you share some portion of the code for TableLayoutPanel and remember to have the code blocks for code snippets you put in.
0
morfix78's Avatar
Go4Expert Member
I create a new panel and add it to the tablelayoutpanel.
after adding it I get a the panel which I added earlier and i change it's BackColor property.
I declare a array of panels:
" private Panel[,] connectivityPanels = new Panel[12,12] ; "
the part where i create panels which i put in the tablelayoutpanel:
" connectivityPanels[i, j] = new Panel();
ConnectivityTableLayoutPanel.Controls.Add(connecti vityPanels[i, j], i + 1, j + 1);"
the part where i change the color:
" connectionsPanels[i].BackColor = connectedColor.BackColor;"

thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Adding is fine but what is important is does parent relays the paint to the child or not.
0
morfix78's Avatar
Go4Expert Member
Can you please tell me what do you mean by saying parent relays the paint to thechild or not?
how can I know it?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Say when I have control which is a parent control and has some child windows / control then the paint and the messages can flow in 2 direction of parent notifying child and the vice versa. Just look into your case if the paint is correctly getting relayed.