Hi there,
I am a C# Newbie and need to create an application with a user control. The user control must consists of three panels, each with a different colour. I must use Properties, get and set, to return the colour of the panel.
My problem is that I have no idea how to reference the panels' colour in the properties. To create a single panel with a single colour is fine, but doing it with three is a problem for me.
Help will be appreciated.
User Control with Panels
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mike Hankey62 reputationPosted Jun 16, 2008, 2:40 PM EDT
Its the same for three as for one.
private Color _Panel1Color;
public Color Panel1Color
{
get { return _Panel1Color; }
set
{
_Panel1Color = value;
Panel1.Color = _Panel1Color; //Set the panels actual color here!
}
}
Repeat this for the other 2 panels.
Hope this helps,
Mike
Jacques Vd Westhuizen3 reputationPosted Jun 17, 2008, 7:40 AM EDT
Thanks for your help. It worked great.
Thanks again.
Regards
Jacques