Better method than mdi parent/child forms

AlexJames

Well-known member
Joined
Mar 20, 2020
Messages
65
Programming Experience
10+
Hi All

I'm relatively new to C# and 90% of my experience is in the older languages. I'm busy with a new WinForms C# project which simply has a docked panel on the main form with a bank of buttons to mimic a menu, when one of these menu buttons is clicked I just need to display a new form but with my left menu still visible and clickable. I was playing around with setting up the main form as the mdi parent and the forms to be shown as the child forms. This seems to work ok, but i have quite a bit of UI design and the child forms don't quite display as i would like. So my question really is, is there a better we to achieve this without using mdi parent and child forms ? i also believe that this method is out dated.

Many thanks.
AJ
 
Hi All

I've tried a few things out but cant get rid of the visible resizing issue, I've done a fair amount of research and it seems generally accepted to show the user control in a panel. The code below works well, i'm now just trying to figure out how to close the user control form once its open.

C#:
                    UcDeposits uc = new UcDeposits();
                    PnlContainer.Controls.Add(uc);
                    uc.Dock = DockStyle.Fill;
                    uc.BringToFront();

Thanks again.
 
Where is your code to suspend and resume layout like we recommended?

Where did you implement the recommendation to set the dock style before adding the control?
 
Hi Skydiver

After a lot of research and more planning on my app, I've decided to stick with my original plan of loading a form into a docked panel. The only downside i can find about using this method is memory usage, luckily the app is quite small and using WinForms will give me the control i'm looking for, so i don't think that will be too much of an issue. But a big thank you to both of you again, i went down a path of loads of research because of your guy's suggestions and learned loads.

regards
AJ.
 
Back
Top Bottom