awilderbeast
asked on
C# windows form, open a form from another form in same window
hi all, just creating my first windows app have the below code
only problem is that it opens the form in a new window, i would like to have the form open in the same window
that possible?
Thanks
only problem is that it opens the form in a new window, i would like to have the form open in the same window
that possible?
Thanks
void _CompaniesFrm(object sender, ExecuteEventArgs e)
{
App.Companies.FrmCompanies obj = new App.Companies.FrmCompanies();
obj.Show();
}
ASKER
so an MDI window would give the apperance of them looking like their in one window though?
child forms go in the same window though dont they?
Thanks
The MDI window acts as a parent for the child windows. So each child will appear within the bounds of the MDI parent form, but they will still be separate windows.
This is worth a read to help clarify things:
http://www.c-sharpcorner.com/UploadFile/ggaganesh/DevelopingMDIAppplicationsinCSharp11272005225843PM/DevelopingMDIAppplicationsinCSharp.aspx
This is worth a read to help clarify things:
http://www.c-sharpcorner.com/UploadFile/ggaganesh/DevelopingMDIAppplicationsinCSharp11272005225843PM/DevelopingMDIAppplicationsinCSharp.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that example is exactly what i needed, got it sorted now
is there a way i can hide/remove the title bar and menu so it looks like its the same page?
is there a way i can hide/remove the title bar and menu so it looks like its the same page?
ASKER
also is there a way i can change main forms
im guessing close one open another, but is there a way of that happening without screen flicker?
Thanks
im guessing close one open another, but is there a way of that happening without screen flicker?
Thanks
ASKER
i ahve the below but its being cheeky and showing up still
in form load i did the below both ways round (as i read it makes a difference) and it comes back with it almost but not quite each way
in form load i did the below both ways round (as i read it makes a difference) and it comes back with it almost but not quite each way
this.FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
almost.PNG
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi awilderbeast;
To remove the title bar us the property FormBorderStyle as shown below
Fernando
To remove the title bar us the property FormBorderStyle as shown below
NewForm nf = new NewForm( );
nf.TopLevel = false;
// Remove Border / Title bar from the form
nf.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
panel1.Controls.Add( nf );
nf.Show( );
Fernando
ASKER
i dont like the animation between forms, i would like to click and it just be there, without looking like one is openeing and closing
can an application context do this?
Thanks
also thanks to fernado for the hiding border :)
can an application context do this?
Thanks
also thanks to fernado for the hiding border :)
If the forms aren't too complex, another option is to use one form with 2 panels on it. Put all the controls for the first form inside panel1, and all the controls for the second form inside panel2, put the two panels on top of each other, then change their visibility.
Alternatively use Show()/Hide() instead of Open()/Close()
Alternatively use Show()/Hide() instead of Open()/Close()
ASKER
ive tried show hide and open close, they both have animation on them instead of just a static transfer
the problem is im using windows Ribbon for WinForms, and i need a different menu ribbon depending on which section, but im not keen on the crappy animation that happens when you open close, show/hide a form :S
the problem is im using windows Ribbon for WinForms, and i need a different menu ribbon depending on which section, but im not keen on the crappy animation that happens when you open close, show/hide a form :S
>>that example is exactly what i needed, got it sorted now
Using the Panel? The one that I send to you? Whos example?
Using the Panel? The one that I send to you? Whos example?
ASKER
thanks
Hi, first you create one mdi form then when you click on the button of that form at that time write this code
childform objch = new childform();
objch.MdiParent = this.MdiParent;
objch.show();
it is working properly.
childform objch = new childform();
objch.MdiParent = this.MdiParent;
objch.show();
it is working properly.
You can house the forms in an MDI window if you wanted to, but each seperate window would still display separately.