Solved

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

Posted on 2016-09-22
7
42 Views
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?

thanks!
0
Comment
Question by:roujesky
  • 3
  • 3
7 Comments
 
LVL 25

Expert Comment

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

Expert Comment

by:Russ Suter
Comment Utility
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.
0
 

Author Comment

by:roujesky
Comment Utility
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?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 20

Expert Comment

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

Author Comment

by:roujesky
Comment Utility
Russ;
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.

thanks!
0
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
Comment Utility
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?
0
 

Author Closing Comment

by:roujesky
Comment Utility
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.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now