SplitContainer C# Winform Plus another control all the way across the Mainform

Posted on 2016-09-22
Last Modified: 2016-09-22
I have a Form which has a splitcontainer.  I also want a thin control across the top (panel??)  that will hold some labels.  It will be directly beneath the menu.  The problem seems to be that the splitcontainer sizes itself to the size of the form, so any control across the top is invisible.   How do you size the splitcontainer so there is room across the top for that control?

Question by:roujesky
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 26

Expert Comment

by:Shaun Kline
ID: 41811451
By chance are you docking the control instead of anchoring it? The splitter container does not, by default size to the entire form.
LVL 20

Expert Comment

by:Russ Suter
ID: 41811493
Create a control, like a Panel, that you then dock to the window. After that, dock the SplitContainer to the same form. The SplitContainer will then occupy the remaining space on the form not already consumed by the docked Panel control.

Author Comment

ID: 41811497
I no longer dock the splitcontainer.  I have tried anchoring it Top,Left and Bottom, Right and it doesn't seem to make a difference.  I put a toolStrip across the top, and it is on top, but now the splitcontainer is behind it some, so the scrollbar for the splitcontainer is behind the toolStrip.
What is the preferred way to do this?
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

LVL 20

Expert Comment

by:Russ Suter
ID: 41811498
The preferred way to do this is to dock the controls as I have indicated. What is the reason you are not docking it?

Author Comment

ID: 41811516
I was experimenting with docking because of Shaun's comment.
Now I have the both the splitcontainer and the toolStrip docked andthe splitcontainer not anchored.  The splitcontainer is still behind the toolStrip.  The splitcontainer seems to size itself to the form and not the form+toolStrip.....
Not sure how to proceed.

LVL 20

Accepted Solution

Russ Suter earned 500 total points
ID: 41811523
OK, I just tried this. Here are the steps that worked for me.

1. Create a new Form
2. Add a MenuStrip control and put a couple of items on it
3. Add a Panel control. Set its Dock property to "Top" and size it appropriately.
4. Add a SplitContainer control. It will automatically fill the remaining form space since its default Dock property is "Fill".
5. Add a ToolStrip control inside the Panel control that was previously added.
6. Resize the Panel control as you see fit. The SplitContainer control will adjust to accommodate.

Is that what you're after?

Author Closing Comment

ID: 41811565
Thanks.  I finally bit the bullet and deleted everything off my form, followed your instructions and it worked.  Not sure why I could not modify my existing splitcontainer and toolStrip  and make them behave....   Adding back my components and code now.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question