Controls and Docking

D

Daniele Fornaciari

Hi,
I'm writing a particular Control.
Name: PanelTiteled
Derived from: Panel
Use a particular control: PanelGradientText (A panel with a background
gradit and a text).
In PanelTiteled PanelGradientText has Dock = DockStyle.Top
When in main application I use PanelTiteled and I add a control like
GroupBox to this object with Dock = DockStyle.Fill a part of this going
under PanelGradientText and I cannot to see it.
I think this is produced by the order in which I add Control to
PanelTiteled.Controls. So I write this code:


PanelTiteled plCenter = new PanelTiteled();
GropBox gb = new GropBox();
gb.Dock = System.Windows.Forms.DockStyle.Fill;
plCenter.Controls.Add(gb);

//.............................................


foreach (System.Windows.Forms.Control c in plCenter)
{
plCenter.Remove(c);
plCenter.Add(c);
}


And So I can See correct, but I think this isn't a good code.

Someone can help me?

Thanks.

Daniele
 
G

gaidar

You can add simply another panel and add controls to it then user place
something on your control in design-time.

Gaidar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top