Using the splitter control

G

Ginny

Hi,

I have a form with a tree view control docked on the left side, a list view
control docked on the right side. i am using a splitter now. the splitter
can only be docked to left or right, means it can be glued either to the
tree view control or to the list view control. How can I glue it to both so
that I can get windows explorer style splitting & resizining. Is there any
other mechanism to this?
 
R

R3al1ty

To get the Win Explorer behaviour:

Add TreeView
Dock it to Left
Add Splitter
Dock it to Left
Add List View
Dock it to Fill

You can also use the SplitContainer control which does all this for you.
 
S

Stoitcho Goutsev \(100\)

Ginny,

Just a little explanation how the splitter works.
The splitter has to be docked against a controlthat is not docked fill. When
the splitter moves it changes the free dimention size of the control it is
docked against. For example if you have control docked up its Width is fixed
to fill all the available space, but its Height s free and can be set to any
value. Thus if dock a control Top and then add a splitter and docked Up also
when moving the splitter up and down it will actually change the control's
free dimention which is Height in this case. In order the splitter to work
as a splitter the rest of the space should be filled with another control
docked fill. Fill controls doesn't have free dimention and always fill up
the available space. And thre is how it works. You move the splitter it
changes on of the control's dimentions (which it is docked agains) which
changes the amound of available space, which on the other hand is filled up
from the fill control.

To summarize in order to have a splitted view you need a control docked to
one of the sides, a splitter docked to the same side and a control docked
fill.
 

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