Today I created a C# Winform with a ToolStrip and a SplitContainer beneath it. I wanted the SplitContainer to fill all of the form’s area but should start just under the ToolStrip, just like what you see in a normal Windows Form. To cover all area on the form and resize the SplitContainer with Form resize action I set the Dock property to FILL and the ToolStrip’s Dock property to TOP. The result was a SplitContainer spanning the whole Form and a ToolStrip on top of it. No! I tried a couple of different Dock value combinations with these controls but every time the result was one of them hiding the other one. And if you don’t set the Dock property it won’t resize itself with the Form. After a little research on the internet and trying with different options I figured it out. The solution was not with the Docking values combination, they were right at the very first instance. It is the “Z” order of your controls which matter. Either:
- Right click on SplitContainer and select “Bring to Front”
- Or call BringToFront() in the code
The ToolStrip has to be at the back but since its Dock is set to TOP it will always be shown. And since SplitContainer is now brought at the Front it can’t be hidden by the ToolStrip.
I had a very similar problem- CrystalReportViewer control set to FILL covered by a criteria panel docked to TOP. Your solution worked like a champ! Thanks!
Champ indeed, thanks heaps
thanks a lot,
that problem pissed me off for a few moments 🙂
Your solution worked, Thanks!
Excellent post, helped me out. Thanks !
Brilliant, thanks 🙂
You are the best!!!!!
Thanks, just what I was looking for!
Also thanks … simple solution to an anoying problem.
Brilliant Thanks!
Thank you…….. 😀
Thank you!
I had same problem with my own control. You sloved it. Thanks very much.
Man, you’re genius! 🙂 Thanks very much, I don’t find it logical, but it works!
Who would thought of that…
ZOMG I was tearing my hair out on this one. I had resorted to putting 3 panels on every form/tab, one for toolstrip, one for statusbar, and one for splitcontainer. Thanks!
worked. thanks.