Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   enable to redraw inner control (http://www.go4expert.com/forums/enable-redraw-inner-control-t6379/)

morfix78 16Sep2007 19:22

enable to redraw inner control
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?

shabbir 17Sep2007 09:18

Re: enable to redraw inner control
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.

morfix78 17Sep2007 14:53

Re: unable to redraw inner control
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;"


shabbir 17Sep2007 17:54

Re: enable to redraw inner control
Adding is fine but what is important is does parent relays the paint to the child or not.

morfix78 17Sep2007 18:14

Re: enable to redraw inner control
Can you please tell me what do you mean by saying parent relays the paint to thechild or not?
how can I know it?

shabbir 17Sep2007 18:23

Re: enable to redraw inner control
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.

All times are GMT +5.5. The time now is 08:56.