Jump to content
  • Advertisement
Sign in to follow this  
Supaflyfrank

Multiple Form

This topic is 4491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My question is how do I make multiple interfaces in C# Forms? Example such as when you have a installer running you first have text box then you hit next then you have options then hit next, then it installs. How do I simulate the "changing form" so I can have a next button that displays and interacts with the user different. Im trying to make a game file editor but all the information needed to input is to large so I need to have a next button so I can then work on the other information. But how can I accomplish that. Do they simple close the current window/form and open a new one? Or do they just have all the stuff hidden and display the needed stuff and hide the rest? The problem with my first option is what happen if I have a common object such as a menu do I simply have to just recreate it? Would I just inherit from the template form the one with all the default stuff on it? And the hiding and displaying option I would think it will get VERY difficult to edit and manipulate using the .Net Form Editor. Any suggestions will help alot thank you.

Share this post


Link to post
Share on other sites
Advertisement
I usually take the approach of having the main dialog form and the sections in child forms. Now when you press next the current child dialog is removed and the next child dialog created and inserted.

To insert, set the child style and set the parent to the main dialog.

Depending on your app you might create all the child forms on initialisation and simply hide and show appropriately (easier if you need to keep set values in the sub controls).

Share this post


Link to post
Share on other sites
everything i look up for child form etc... come up with MDI. Im trying to really just create the effect of Tabed Control but instead of having the visible tab have buttons on the bottom switch throw the form.

Share this post


Link to post
Share on other sites
also I tried creating another form and then displaying it at the exact position the current form is and then just hiding the previous form and it seems like the new form displays just a few pixels down and right of the previous form. So I cant the percise overlapping
private void button2_Click(object sender, EventArgs e)
{
Form2 Child = new Form2();

Child.DesktopBounds = DesktopBounds;


Child.Show();

Hide();

}

DesktopBounds being the size and location.

Share this post


Link to post
Share on other sites
Try using .Location for setting the position relative to the parent.

I guess you've got the parent-child-relationship down already by setting ChildForm.Parent to the parent form.

Share this post


Link to post
Share on other sites
.Net forms doesn't really use the concept of 'child forms'. A form can contain Control objects, but not other forms.

What you probably want to do is either:

Make a Panel with the 'Autoscroll' property enabled so that its controls scroll (this works in the form designer - try it out)

or

Add a TabControl, and make a 'next' button move between tabs.

Share this post


Link to post
Share on other sites
I've done that already so it obviously is possible. A form is just a HWND, so you can set a form as a child inside a form without any bigger problems.

A tab control would be pretty useless without having child forms containing the tab pages content.

I do confess that i'm not that active in .NET and i might be wrong but i'm sure that the above statements are correct.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!