473,378 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Splitters and Docking

Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried creating
background panels and docking them with the controls on the panels but the
docking order seems to be random! Another useless control from Microsoft I
think!
--
Dennis in Houston
Nov 21 '05 #1
25 5276
"Dennis" <De****@discussions.microsoft.com> schrieb:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried
creating
background panels and docking them with the controls on the panels but the
docking order seems to be random!


Use the "Bring to foreground" and "Send into background" context menu items
of the controls in the Windows Forms designer to control the docking order.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
"Dennis" <De****@discussions.microsoft.com> schrieb:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried
creating
background panels and docking them with the controls on the panels but the
docking order seems to be random!


Use the "Bring to foreground" and "Send into background" context menu items
of the controls in the Windows Forms designer to control the docking order.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
Dennis,

The splitter works fine when you know how, just some trying.

Your problem with the docking has nothing to do with the splitter, however
with the designer. When you use that it adds it in the way you drags it on
the form (Zorder).

It is easy to change in the designer generated code. Not efficient however
not really very expensive for performanse in my opinion is as well removing
those controls and adding them once in the load event (When you do it using
the designer you can do it everytime again when you change something)

What I find also very usefull to do is hidding and showing them. I have
forms where I have panels over panels as well splitting horizontal as
vertical. For that is however as well that Z order needed. (Z order is from
bottom to top.)

I hope this helps?

Cor
Nov 21 '05 #4
Dennis,

The splitter works fine when you know how, just some trying.

Your problem with the docking has nothing to do with the splitter, however
with the designer. When you use that it adds it in the way you drags it on
the form (Zorder).

It is easy to change in the designer generated code. Not efficient however
not really very expensive for performanse in my opinion is as well removing
those controls and adding them once in the load event (When you do it using
the designer you can do it everytime again when you change something)

What I find also very usefull to do is hidding and showing them. I have
forms where I have panels over panels as well splitting horizontal as
vertical. For that is however as well that Z order needed. (Z order is from
bottom to top.)

I hope this helps?

Cor
Nov 21 '05 #5

splitter control allows the user to resize THE DOCKED CONTROL that is
IMMEDIATELY BEFORE IT.
Therefore, to enable the user to resize a docked control at run
time:
1. Dock the control to be resized to an edge of a container.
2. Dock a splitter control to the same side of that container.

e.g: 1 splitter.
control1.Dock = DockStyle.Left
splitter1.Dock = DockStyle.Left
splitter1.MinExtra = 100
' Set the minimum size control2 can be sized to.
splitter1.MinSize = 75
' Set the minimum size control1 can be sized to.
control2.Dock = DockStyle.Fill
' Set control2 to fill the remaining space on the form.
Me.Controls.AddRange(New Control() {control2, splitter1,
control1}) ' Add in reverse order to ensure proper location.

e.g: 2 Splitters.
control1.Dock = System.Windows.Forms.DockStyle.Left
control1.Width = Me.ClientSize.Width \ 3
control2.Dock = System.Windows.Forms.DockStyle.Top
control2.Height = Me.ClientSize.Height * 2 \ 3
control3.Dock = System.Windows.Forms.DockStyle.Fill

splitter1.Location = New System.Drawing.Point(121, 0)
splitter1.Width = 3
splitter2.Dock = System.Windows.Forms.DockStyle.Top
splitter2.Height = 3

panel1.Controls.AddRange(New System.Windows.Forms.Control()
{control3, splitter2, control2}) ' Add in reverse order to ensure proper
location
panel1.Dock = System.Windows.Forms.DockStyle.Fill

Me.Controls.AddRange(New System.Windows.Forms.Control() {panel1,
splitter1, control1}) ' Add in reverse order to ensure proper location

Good Luck.
Atara

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6

splitter control allows the user to resize THE DOCKED CONTROL that is
IMMEDIATELY BEFORE IT.
Therefore, to enable the user to resize a docked control at run
time:
1. Dock the control to be resized to an edge of a container.
2. Dock a splitter control to the same side of that container.

e.g: 1 splitter.
control1.Dock = DockStyle.Left
splitter1.Dock = DockStyle.Left
splitter1.MinExtra = 100
' Set the minimum size control2 can be sized to.
splitter1.MinSize = 75
' Set the minimum size control1 can be sized to.
control2.Dock = DockStyle.Fill
' Set control2 to fill the remaining space on the form.
Me.Controls.AddRange(New Control() {control2, splitter1,
control1}) ' Add in reverse order to ensure proper location.

e.g: 2 Splitters.
control1.Dock = System.Windows.Forms.DockStyle.Left
control1.Width = Me.ClientSize.Width \ 3
control2.Dock = System.Windows.Forms.DockStyle.Top
control2.Height = Me.ClientSize.Height * 2 \ 3
control3.Dock = System.Windows.Forms.DockStyle.Fill

splitter1.Location = New System.Drawing.Point(121, 0)
splitter1.Width = 3
splitter2.Dock = System.Windows.Forms.DockStyle.Top
splitter2.Height = 3

panel1.Controls.AddRange(New System.Windows.Forms.Control()
{control3, splitter2, control2}) ' Add in reverse order to ensure proper
location
panel1.Dock = System.Windows.Forms.DockStyle.Fill

Me.Controls.AddRange(New System.Windows.Forms.Control() {panel1,
splitter1, control1}) ' Add in reverse order to ensure proper location

Good Luck.
Atara

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #7
Thank you for your replies. I didn't know that that the Zorder affected the
way the controls were docked. It's still difficult to get the controls and
splitters where you want them.

"Dennis" wrote:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried creating
background panels and docking them with the controls on the panels but the
docking order seems to be random! Another useless control from Microsoft I
think!
--
Dennis in Houston

Nov 21 '05 #8
Thank you for your replies. I didn't know that that the Zorder affected the
way the controls were docked. It's still difficult to get the controls and
splitters where you want them.

"Dennis" wrote:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried creating
background panels and docking them with the controls on the panels but the
docking order seems to be random! Another useless control from Microsoft I
think!
--
Dennis in Houston

Nov 21 '05 #9
Ok, I got the splitter to working and the panels where I want them. However,
when I add two controls and a splitter between them to a panel as chldren of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.

"Cor Ligthert" wrote:
Dennis,

The splitter works fine when you know how, just some trying.

Your problem with the docking has nothing to do with the splitter, however
with the designer. When you use that it adds it in the way you drags it on
the form (Zorder).

It is easy to change in the designer generated code. Not efficient however
not really very expensive for performanse in my opinion is as well removing
those controls and adding them once in the load event (When you do it using
the designer you can do it everytime again when you change something)

What I find also very usefull to do is hidding and showing them. I have
forms where I have panels over panels as well splitting horizontal as
vertical. For that is however as well that Z order needed. (Z order is from
bottom to top.)

I hope this helps?

Cor

Nov 21 '05 #10
Ok, I got the splitter to working and the panels where I want them. However,
when I add two controls and a splitter between them to a panel as chldren of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.

"Cor Ligthert" wrote:
Dennis,

The splitter works fine when you know how, just some trying.

Your problem with the docking has nothing to do with the splitter, however
with the designer. When you use that it adds it in the way you drags it on
the form (Zorder).

It is easy to change in the designer generated code. Not efficient however
not really very expensive for performanse in my opinion is as well removing
those controls and adding them once in the load event (When you do it using
the designer you can do it everytime again when you change something)

What I find also very usefull to do is hidding and showing them. I have
forms where I have panels over panels as well splitting horizontal as
vertical. For that is however as well that Z order needed. (Z order is from
bottom to top.)

I hope this helps?

Cor

Nov 21 '05 #11
"Dennis" <De****@discussions.microsoft.com> schrieb:
Ok, I got the splitter to working and the panels where I want them.
However,
when I add two controls and a splitter between them to a panel as chldren
of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.


You'll have to select the control above the splitter for horizontal
splitters or the control left to the splitter for vertical splitters and
change its size. This will move the splitter and resize the control docked
on the other side of the splitter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #12
"Dennis" <De****@discussions.microsoft.com> schrieb:
Ok, I got the splitter to working and the panels where I want them.
However,
when I add two controls and a splitter between them to a panel as chldren
of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.


You'll have to select the control above the splitter for horizontal
splitters or the control left to the splitter for vertical splitters and
change its size. This will move the splitter and resize the control docked
on the other side of the splitter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #13
That works in designmode but does not allow resizing in run mode.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
Ok, I got the splitter to working and the panels where I want them.
However,
when I add two controls and a splitter between them to a panel as chldren
of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.


You'll have to select the control above the splitter for horizontal
splitters or the control left to the splitter for vertical splitters and
change its size. This will move the splitter and resize the control docked
on the other side of the splitter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #14
That works in designmode but does not allow resizing in run mode.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
Ok, I got the splitter to working and the panels where I want them.
However,
when I add two controls and a splitter between them to a panel as chldren
of
the panel, they show up ok but I can't resize the widths of the controls
using the splitter between them. It works fine if the two controls and
splitter are directly on a form but when they are children of a panel, it
doesn't work.


You'll have to select the control above the splitter for horizontal
splitters or the control left to the splitter for vertical splitters and
change its size. This will move the splitter and resize the control docked
on the other side of the splitter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #15
"Dennis" <De****@discussions.microsoft.com> schrieb:
That works in designmode but does not allow resizing in run mode.


Mhm... I am not able to repro that using VB.NET 2002.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #16
"Dennis" <De****@discussions.microsoft.com> schrieb:
That works in designmode but does not allow resizing in run mode.


Mhm... I am not able to repro that using VB.NET 2002.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #17
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I works
ok in Design mode.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
That works in designmode but does not allow resizing in run mode.


Mhm... I am not able to repro that using VB.NET 2002.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #18
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I works
ok in Design mode.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
That works in designmode but does not allow resizing in run mode.


Mhm... I am not able to repro that using VB.NET 2002.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #19
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked
with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I
works
ok in Design mode.


I have tried the scenario you described in VS.NET 2002 (I currently don't
have VS.NET 2003 installed) and everything worked just fine.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #20
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked
with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I
works
ok in Design mode.


I have tried the scenario you described in VS.NET 2002 (I currently don't
have VS.NET 2003 installed) and everything worked just fine.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #21
Herfried, I got it to work. You're not going to believe this but the problem
was that I had the vertical splitter sized to only 1 pixel and I wasn't
getting the mouse over it to resize the two controls on either side of it. I
changed to splitter size to 4 pixels wide and it works fine...what a dumb
mistake! Sorry for causing you to spend time on this kind of thing but
thanks anyway as your notes gave me confidence to keep working at it for the
solution.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked
with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I
works
ok in Design mode.


I have tried the scenario you described in VS.NET 2002 (I currently don't
have VS.NET 2003 installed) and everything worked just fine.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #22
Herfried, I got it to work. You're not going to believe this but the problem
was that I had the vertical splitter sized to only 1 pixel and I wasn't
getting the mouse over it to resize the two controls on either side of it. I
changed to splitter size to 4 pixels wide and it works fine...what a dumb
mistake! Sorry for causing you to spend time on this kind of thing but
thanks anyway as your notes gave me confidence to keep working at it for the
solution.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I'm using vb2003. I have a panel with child controls that has a listview
docked to the left, a Splitter docked left and another listview docked
with
Fill. In run move, when I put the mouse on the splitter, I don't get
anything and can't resize the widths of the controls with the mouse. I
works
ok in Design mode.


I have tried the scenario you described in VS.NET 2002 (I currently don't
have VS.NET 2003 installed) and everything worked just fine.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #23
Dennis,

I believe this, because I had all those same problems as you the first time
with the splitter.

:-)

Cor
Nov 21 '05 #24
Dennis wrote:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried creating
background panels and docking them with the controls on the panels but the
docking order seems to be random! Another useless control from Microsoft I
think!


The way it works for me is thinking ahead and then adding the controls
in the right order. So if I want 2 panels with a vertical splitter I add
1 panel, then the splitter, then the next panel. This seems to work for me.

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #25
Here is a generic algorithm I wrote to add multiple items to a panel with
splitters between them. This should handle between 1..N controls.

Control main = null;
Control p = null;
Spliter sp = null;
ArrayList list = new ArrayList();

....
add controls to list that you want to have splitters between
....

// loop through the list of controls that we want to add to the panel
// with a horizontal splitter between each one.
// We will loop through the list backwards to get the items to start
// at the top with the first item in the list
for (int nIndex = list.Count - 1; nIndex >= 0; nIndex--)
{
// if we already have a panel, then add the current panel to a new panel as
a fill and add a splitter
if (main != null)
{
// store a reference to the current control
p = main;

// create a new panel control that will hold the old control and the
current list item
main = new Panel();
main.Dock = DockStyle.Fill;

// add the previous control to the panel
main.Controls.Add(p);

// create a new splitter and add it to the new panel we just created
sp = new Splitter();
sp.Dock = DockStyle.Top;
main.Controls.Add(sp);

// set the previous control to dock at the top and then add it to the new
panel
// we just created
((Control)list[nIndex]).Dock = DockStyle.Top;
main.Controls.Add((Control)list[nIndex]);
}
else
{
// set the main control to the current list item control that
// we are iterating through
((Control)list[nIndex]).Dock = DockStyle.Fill;
main = (Control)list[nIndex];
}
}

// set the dock and height of final control and add it to the
// client panel we want to display it in
main.Dock = DockStyle.Top;
main.Height = (int)(panel1.Height * .5 * list.Count);
panel1.Controls.Add(main);

Although this simply adds 1..N controls with horizontal splitters between
them, it can be customized to do vertical or mixed for any number of controls.

Ashton Hobbs
ApexSQL Edit
http://www.apexsql.com

"C-Services Holland b.v." wrote:
Dennis wrote:
Has anyone really gotten the Docking and Splitter Bars to work for anyting
but the simplest application for two controls and one splitter bar filling
the whole form? If so, can you enlighten my on HOW! I even tried creating
background panels and docking them with the controls on the panels but the
docking order seems to be random! Another useless control from Microsoft I
think!


The way it works for me is thinking ahead and then adding the controls
in the right order. So if I want 2 panels with a vertical splitter I add
1 panel, then the splitter, then the next panel. This seems to work for me.

--
Rinze van Huizen
C-Services Holland b.v.

Nov 21 '05 #26

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Lecture Snoddddgrass | last post by:
Greetings, Can anyone recommend a good 3rd party docking windows component for WinForms? I'm looking for something that allows windows to not only be docked but to "popout", much like the...
2
by: Gary Shell | last post by:
We are playing around with using the splitter on a form and want to do the following: 1. On the left side of the form will be a tree view. 2. To the right of that tree view would be a splitter....
0
by: Dennis | last post by:
Has anyone really gotten the Docking and Splitter Bars to work for anyting but the simplest application for two controls and one splitter bar filling the whole form? If so, can you enlighten my on...
3
by: Rob Mayo | last post by:
This is a stupid problem to have, but here goes. I wanted to make like an Outlook-looking app. Multiple splitters, panes, etc. If I ... 1. Take a Form, add a TreeView, dock it Left. 2. Add a...
4
by: Enrique | last post by:
hi all, i'd like to know how i could do a docking menu and docking toolbar. i know it's not so easy y VS .NET 2002 and 2003. anything will help me: links, code, articles..... thanks a...
1
by: Joe | last post by:
I'm creating a C# application, and want to use docking windows. However, I want the docking windows to look like the docking windows withing VS2005, with a title bar, close button, etc... When...
0
by: ohadasor | last post by:
Hello, I'm using .NET Framework 2.0. I'm creating several panels, one above the other, with splitters between them. I'm using Splitter and not SplitContainer, because the latter is such a big...
2
by: Matt Brown - identify | last post by:
Hello, I've spent the better part of the day going over code and thinking and have come up with the following docking method that works perfectly. At this point, my brain is about to explode...
2
by: =?Utf-8?B?aGVyYmVydA==?= | last post by:
I need to develop a "docking station" simulator for Apple IPod in .NET. The PC acting as a development station connects to the IPod docking station using a parallel port. Where is this software...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.