Splitter Control Bug?

T

Tyler Allen

Here is what I am doing:

Add a control and dock it to the left.
Add a splitter and dock it to the left.
Add a control and dock it to fill.

Add a button and have it toggle the dock of the first control and the
splitter to TOP and LEFT.

Everything should work as you would expect it to. Now slide the splitter and
do the toggle. What it appears to be doing is resizing the FILL control to a
location of 0 which places the splitter and the first control out of bounds
of the form.


Any ideas or thoughts?
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi Tyler,

This is not what happens.
I'll talk about the case when you change first control's and splitter's dock
to TOP. The other case is symmetric.
So when you change dock properties parent control starts layouting its
children.
It starts with the first control. It changes first conrols width to fill the
patent't entire width and leaves the height as is. Because previous docking
of the first control was LEFT first control's Height is equal to the
parent's client rectangle height. At this moment the first control covers
entirely its parent. And then the parent layouts the splitter and the secont
control, which are not visible (they are under the first control and out of
the parent client area).
So what fills the parent and looks like docked FILL is not the second
control it is the first control docked TOP. If you resize the form down a
bit you will see the splitter, you can move it and it will work how it's
suppose to work
 

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