Solved

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

Posted on 2016-09-22
7
53 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 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.
0
 
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.
0
 

Author Comment

by:roujesky
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?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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?
0
 

Author Comment

by:roujesky
ID: 41811516
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
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?
0
 

Author Closing Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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