Marc,
Thank you very much for your follow up. I again missed to mention that I'm
using a SplitterContain er inside another SplitterContain er, first one
(Parent) has vertical orientation and 2nd (Child) has horizontal orientation.
I just like to mention if it may help to find some clue.
But even with this addition to your code, its still working properly and its
annoying me so much that why it is not working for me not even at design
time. My project is currently not so big, it has a single form only and I
check it out and find nothing different I'm doing in it.
Here's your coding with addition of another child SplitterContain er and its
working.
using System;
using System.Windows. Forms;
using System.Drawing;
class Program
{
static void Main()
{
using (Form form = new Form())
using (SplitContainer sc = new SplitContainer( ))
{
SplitContainer scl = new SplitContainer( );
scl.Orientation = Orientation.Hor izontal;
scl.Panel1.Back Color = Color.Red;
scl.Panel2.Back Color = Color.Blue;
AddPanels(scl.P anel1);
AddPanels(scl.P anel2);
sc.Dock = DockStyle.Fill;
scl.Dock = DockStyle.Fill;
sc.Panel1.Contr ols.Add(scl);
form.Controls.A dd(sc);
Application.Run (form);
}
}
private static void AddPanels(Split terPanel panel)
{
for (int i = 0; i < 5; i++)
{
Panel p = new Panel();
Button b = new Button();
b.Location = new System.Drawing. Point(10 * i, 10 * i);
b.Click += delegate
{
p.SendToBack();
};
b.Text = "Panel " + i.ToString();
p.Dock = DockStyle.Fill;
p.Controls.Add( b);
panel.Controls. Add(p);
}
}
}
regards,
Adil
"Chris Dunaway" wrote:
Adil Akram wrote:
Marc,
I tried placing several panels in same project on another form and their
BringToFront/SendToBack working both at design time and runtime. I think the
SplitterContain er is the real culprit and prevents panels to work properly.
Have you any solution for the panels inside SplitterContain er to work or
I'll have to use Visible property.
I gather you are trying to have one or more panels inside a
SplitterContain er and then selectively show and hide them?
Rather than using panels, use UserControls. You can design them
separately and show them inside the panels of the SplitterContain er.
You can also do this using forms instead of UserControls.
Chris