0

I have mdiparent form which has menu and a panel on the left which includes treeview. the remaining space of the parent form can include multiple windows depending on the user how many he wants to open it. There is a splitter in the edge of the panel[ the one with treeview, on the left] which can increase or decrease the width of the panel and thereby increasing the area for the chart.

I have tried using the mdilayout in splitter move event handler, but it does not work. The red vertical line is the splitter to increase/decrease the width of the panel on the left. Initially, there is no space on the right side . opening a new child window fits well in the remaining space.

Splitter moved to the left. There is a space in the right, child form does not resize and fit to the areaSplitter moved more to the left and space on the right keeps increasing. If I open one more graph then 4 old and 1 new , total 5 forms fill perfectly fit well and space will be utilized. if I move the splitter again then space on the right side will be introduced again.

How can I make all the child forms to exactly fit the remaining space, each time the splitter moves?

Code in Splitter move/mouseup event handler.

    this.LayoutMdi(MdiLayout.TileHorizontal);       

Child Forms [ the graph windows] have

    this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

Parent Form [ which is in the picture]

    this.leftpanel.Dock = System.Windows.Forms.DockStyle.Left;
    this.leftpanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    this.AutoSize = true;

If parent form is resized then resize event handler is also

    this.LayoutMdi(MdiLayout.TileHorizontal);

which seems to work well. if I maximize / custom size parent form, child forms resize accordingly .

if I use same thing for , splitter eventhandlers, it does not work in the same way.

Thanks,

2
  • I'd guess that the faster you move the splitter, the more space you'd get. Something wrong with your code, we can't see it. Jun 12, 2013 at 13:28
  • I have edited the post ! yes, the faster I move, the more space I get. if I move it slowly, I will get less space. It is a random behavior I believe or I don't understand the logic of why fast and slow will behave differently. Jun 13, 2013 at 9:04

1 Answer 1

0

Tried something like this?

Form.Anchor = AnchorStyles.Left | AnchorStyles.Top;
5
  • Sorry then :/ no clue Are you using a SplitContainerControl or a Splitter Jun 12, 2013 at 9:35
  • just a splitter,I could ve used a SplitContainerControl.It can serve the purpose. But for that I will have to add all the child forms in the panel. It can cause a performance issue in my application. Since , I don't know how many child windows a panel will be able to handle. Jun 12, 2013 at 9:54
  • Well to be honest it's worth a shot at least :) Jun 12, 2013 at 10:08
  • yes , unfortunately it did not work. layout logic works fine in form resize event handler. it should work in the splitter event handler. so frustrating ! Jun 13, 2013 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.