Skip to main content
gamedev.net
🔒 Locked

Multiple Form

Started by Supaflyfrank 5 replies 800+ views
Original Post
Supaflyfrank
Supaflyfrank
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.
Endurion
Endurion
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).
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
Supaflyfrank
Supaflyfrank
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.
Supaflyfrank
Supaflyfrank
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.
Endurion
Endurion
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.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
Nypyren
Nypyren
.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.
Endurion
Endurion
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.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.