开发者

using winforms , mdi , parent and child form, opening child forms in specified space under the parent form

I have a winform MAINFORM , and need to open child forms in this form as shown in the image. The black portion is a panel & would contain a no. of LinkLabels and Treeview with multiple nodes. In the rest of the portion i want to display the child forms when the linklabels on the panel would be clicked.

The child forms should exactly fit into the remaining space i.e. space excluding the space covered by the panel.

Please help me out wit开发者_JAVA技巧h the code, how to fit the new form in the left space.

Also, i would like to ask, that, shall i use the panel or is there some other control which could be more efficient or better here. Also, does the MAINFORM needs to be made an MdiContainer?

using winforms , mdi , parent and child form, opening child forms in specified space under the parent form


Winforms already does this automatically. You don't have to write any code, simply set the Dock property of the panel control to Left in the designer. The darkgray MDI client area automatically shrinks to occupy the remaining space. Any MDI child windows you create won't overlap the panel, they are constrained to the MDI client area.


I'd have a user control interface on the right docked to fill the remaining space, and each time a link is clicked I'd populate the control interface with a specific control designed for that link labels content. That way you can forget about anything MDI related and for me at least, it would be a lot neater.

In a bit more detail, and a bit of a simpler way, basically everytime a link on the left is clicked, you create a user control that displays the relevant content for that link and display it on the right, docked to the main form so it fills the screen.

Then when another link is clicked, this control on the right is removed and the new one loaded. Have a read about creating user controls and see what you think about this method.

Here's a link to get you started: Creating and using Windows Forms Control Library (User Control) in C#.net

To split the form into sections, take a look at the Splitter control

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜