splitter problems

J

John

Hi,
I have a group of controls in a panel on the right-hand side of a
splitter and a treeview on the left-hand side.
The only configuration that I can find to make the right-hand side
resize correctly is:

lhsTreeview - Dock = Fill, Anchor = Top,Left
splitter - Dock = Right
rhsPanel - Dock = Right, Anchor = Top,Left

The problem is that resizing the form repositions the splitter, making
the the left-hand side treeview grow, I would rather that the splitter
not reposition, resulting in the right-hand side growing.

What settings should be changed to make this happen.

Thanks
 
S

Stefan

hi john
the splitter and it's functions really depends on the order where
the control are placed on the form.
i would do the following
1. place the treeview - Dock = left
2. place the splitter - Dock = left
3. place rhsPanel - Dock = fill
 
F

Frans Bouma

John said:
Hi,
I have a group of controls in a panel on the right-hand side of a
splitter and a treeview on the left-hand side.
The only configuration that I can find to make the right-hand side
resize correctly is:

lhsTreeview - Dock = Fill, Anchor = Top,Left
splitter - Dock = Right
rhsPanel - Dock = Right, Anchor = Top,Left

The problem is that resizing the form repositions the splitter, making
the the left-hand side treeview grow, I would rather that the splitter
not reposition, resulting in the right-hand side growing.

What settings should be changed to make this happen.

the control that is set to 'fill' will resize when you have a
splitter in place and you resize the window. If you want to have another
control to resize, you have to set that other control to Fill instead of
the treeview, in your case the rhsPanel.

As Stefan said, it depends on the order in the form where the
splitter docks against. You can change that by bringing a control to the
front / sending it to the back in the gui designer.

FB
 
J

John

Stefan said:
hi john
the splitter and it's functions really depends on the order where
the control are placed on the form.
i would do the following
1. place the treeview - Dock = left
2. place the splitter - Dock = left
3. place rhsPanel - Dock = fill

Thanks, but that configuration will not reposition the controls on the
rhs, ie. moving the splitter right will move the treeview over the rhs
controls.
 
P

Pete

Hi,
Thanks, but that configuration will not reposition the controls on the
rhs, ie. moving the splitter right will move the treeview over the rhs
controls.

Have you set the Anchor styles for the controls on the right panel? The
panel itself is DockStyle.Fill so it will resize okay.

-- Pete
 
J

John

Frans said:
As Stefan said, it depends on the order in the form where the
splitter docks against. You can change that by bringing a control to the
front / sending it to the back in the gui designer.

This is correct, the problem is that the order is determined by the
order that you place the controls on the form in the Design view. The
left-hand side control *must* be placed on the form before right-hand
side control. If you placed the right-hand control on first, you must
remove all your controls and start from scratch. I could not find anyway
to get it to work, after placing the right-hand side control first,
either by send to back / front or manually moving the control creation
code in InitializeComponent().

MS Moderators, please take note of this and create a KB article, and,
please, fix it for the next release.

Thanks
 
J

John

John said:
MS Moderators, please take note of this and create a KB article, and,
please, fix it for the next release.

The following code in the splitter1.LocationChanged event will show that
the right-hand side panel does not change size if it is placed on the
control after the left-hand side panel in Desgin view with following
configuration:

panel2 Dock=left
panel1 Dock=fill
splitter1 Dock=left

private void splitter1_LocationChanged(object sender, EventArgs e)
{
Trace.WriteLine("Panel1 size: " + panel1.Size.ToString());
Trace.WriteLine("Panel2 size: " + panel2.Size.ToString());
}
 
J

John

John said:
The following code in the splitter1.LocationChanged event will show that
the right-hand side panel does not change size if it is placed on the
control after the left-hand side panel in Desgin view

Doh!
"after" should be "before"

Anyways, from the previous posts you get my drift :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top