Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application I have two child forms with no border.
I want to open it in mdi container
but one is open with maximize and the other is normal.
Both forms have maximize windowstate property.
What is wrong? I do not understand.

My Code is as

frmEmployee objEmployee = new frmEmployee();
            objEmployee.MdiParent = this;
            objEmployee.Show();

and
frmVendor objVendor = new frmVendor();
           objVendor.MdiParent = this;
           objVendor.Show();
Posted
Updated 6-Sep-10 21:30pm
v2
Comments
Per Söderlund 7-Sep-10 3:32am    
I tried what you say, with one form there is no problem.
With 2 forms i cannot get both forms windowstate maximized. Only by clicking by hand.
This could be a Visual studio bug?
Yogesh M Patil 7-Sep-10 5:26am    
whatever onenning first child form its not maximize it may be any order

I've used the same thing. Did not face any issues.
Here's the code.
C#
FormChild1 child = new FormChild1();
child.FormBorderStyle = FormBorderStyle.None;
child.WindowState = FormWindowState.Maximized;
child.MdiParent = this;
child.Show();
 
Share this answer
 
Comments
Per Söderlund 7-Sep-10 5:41am    
Try your code with 2 childforms, then you will see the problem.
You can add this line in the load() of both the forms:

this.WindowState = FormWindowState.Maximized;

your code will run the way u want
 
Share this answer
 
Comments
Per Söderlund 7-Sep-10 5:46am    
I tried that one as well, didn't work for me. Only thing was that the second form was bigger.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900