Overlapping Controls Dock Style

A

Adhal

Hello,
I have an issue with overlapping controls when docking. Docking seems to be a major problem,
having to deal with what appears to be the z-order to get it right. The particular issue I have is this:

I have a statusStrip1 and it is docked at the bottom of a form. I have a User-Control that I
defined which I add dynamically using code bellow to DockStyle.Fill:

UserControl1 CB = new UserControl1();
CB.Dock = DockStyle.Fill;
CB.TabIndex = 3;
Controls.Add(CB);

As you can guess the control fills the whole form and underlaps (goes under) the statusStrip
control. How can I avoid this. My current solution is to disable docking and calculating the size of
the control and placing correctly. Would prefer to avoid this...

Another solution is to place the control in a Panel that was placed on the form at design time, a
method I would rather avoid.

Thank you
 
J

Jeff Johnson

I have an issue with overlapping controls when docking. Docking seems to
be a major problem, having to deal with what appears to be the z-order to
get it right.

You've answered your own question. Altering the Z-order (using Bring to
Front / Send to Back) is the only way to control the way docked controls are
displayed.
 
A

Adhal

Jeff said:
You've answered your own question. Altering the Z-order (using Bring to
Front / Send to Back) is the only way to control the way docked controls are
displayed.

Bollocks.. you are right. I played with it before and I couldn't get it to work but now it works.

Thanks... sometimes you go blind staring at the same thing.
 

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