Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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