enable to redraw inner control

Discussion in 'C#' started by morfix78, Sep 16, 2007.

  1. morfix78

    morfix78 New Member

    Joined:
    Sep 16, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  3. morfix78

    morfix78 New Member

    Joined:
    Sep 16, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    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(connectivityPanels[i, j], i + 1, j + 1);"
    the part where i change the color:
    " connectionsPanels.BackColor = connectedColor.BackColor;"

    thanks
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Adding is fine but what is important is does parent relays the paint to the child or not.
     
  5. morfix78

    morfix78 New Member

    Joined:
    Sep 16, 2007
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Can you please tell me what do you mean by saying parent relays the paint to thechild or not?
    how can I know it?
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice