February 6, 2009

Winforms .NET: Docking problem with ToolStrip and StatusStrip

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.



  1. 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!

    Comment by Garth Faigley — March 31, 2009 @ 4:07 am

  2. Champ indeed, thanks heaps

    Comment by martin read — May 25, 2009 @ 7:53 am

  3. thanks a lot,
    that problem pissed me off for a few moments :)

    Comment by diffy — February 10, 2010 @ 1:44 am

  4. Your solution worked, Thanks!

    Comment by Another — March 16, 2010 @ 3:21 am

  5. Excellent post, helped me out. Thanks !

    Comment by John — July 25, 2010 @ 6:24 am

  6. Brilliant, thanks :)

    Comment by Thomas Vestergaard — November 16, 2010 @ 6:04 am

  7. You are the best!!!!!

    Comment by Valter — January 12, 2011 @ 5:34 pm

  8. Thanks, just what I was looking for!

    Comment by gumbald — April 19, 2011 @ 7:46 pm

  9. Also thanks … simple solution to an anoying problem.

    Comment by Ryan — May 19, 2011 @ 5:38 am

  10. Brilliant Thanks!

    Comment by Mark — August 4, 2011 @ 3:17 am

  11. Thank you…….. :D

    Comment by Lokukarawita — September 1, 2011 @ 11:21 pm

  12. Thank you!

    Comment by bwb — October 25, 2011 @ 5:47 am

  13. I had same problem with my own control. You sloved it. Thanks very much.

    Comment by Chief666 — December 28, 2011 @ 10:55 am

  14. Man, you’re genius! :) Thanks very much, I don’t find it logical, but it works!
    Who would thought of that…

    Comment by Andy — July 13, 2012 @ 5:48 am

  15. 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!

    Comment by Eric AInsworth — March 27, 2013 @ 2:09 am

  16. worked. thanks.

    Comment by MT — August 4, 2014 @ 4:40 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme. Create a free website or blog at WordPress.com.


Get every new post delivered to your Inbox.

%d bloggers like this: