views:

17

answers:

1

Hi coders,

Starting from scratch in a new project in which the properties of the default Form1 form have not been altered I drop a SplitContainer on the form and set its properties to:

Anchor - Top, Left

Dock - Fill

Orientation - Vertical

I then drop a second SplitContainer into the left-hand panel (panel 1) of the first SplitContainer and again set its properties to those above except this time the orientation of the splitter is set to horizontal.

I now place two CheckedListBoxes in both the upper and lower panels (panels 1 & 2) of the second SplitContainer. The properties of both CheckedListBoxes are set to:

Anchor - Top, Left

Dock - Fill

I now add a TextBox to the right-hand panel (panel 2) of the first SplitContainer and set its properties to:

Anchor - Top, Left

Dock - Fill

Multi-Line - True

When I compile and run this application the vertical splitter which forms part of the first SplitContainer I added behaves and works exactly as expected - so no problem there. However, the horizontally oriented splitter in the second SplitContainer consistently displays erratic behaviour - the width of the splitter itself changes as it is moved up and down. But this increase or decrease in the width of the splitter is also not consistent with the direction in which it was moved - for example moving it up some distance from its initial position at startup may result in the splitter being thinner than what it was previously while a further resizing upwards results in it being thicker.

The bottom edge of the lower CheckedListBox also moves up and down when I move the splitter and as before this behaviour is not consistent with the direction in which the splitter is moved.

To avoid carrying over changes to a component's properties from one experiment to another I have been trying to figure out what is going on by starting half a dozen or so new projects from scratch and trying out different things including changes to the Anchor, BorderStyle, Dock, and Margin properties, but unfortunately I am none the wiser : -(

Has anyone had similar experience of this erratic behaviour and can offer me a solution? I might be overlooking something simple, if so what is it?

Thanks for reading.

Edit \ Update - Upon further experimentation I was able to determine that the unwanted behaviour I am experiencing is related somehow to the CheckedListBoxes - I replaced both with multi-line textboxes whose properties of "Anchor" and "Dock" were set to "Top, Left" and "Fill" respectively and upon running the app the erratic behaviour no longer occurs - both the vertical and horizontal splitters are working correctly.

+1  A: 

Set the IntegralHeight property of the list boxes to False so that they are allowed to size themselves to fit the panel.

Hans Passant
Thank you, Hans Passant, it is working perfectly now !!! : - )
The Thing