Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a one big Windows Form (Match my laptop Screen Size)
and i have another samller
everytime i load the project the second one goes to the back of the big one
although i sent him (the small one) to front

can someone help me ?
Posted
Comments
#realJSOP 14-May-11 17:35pm    
Is it a modal or modeless form?

Play around with Form[^] options as form1.MaximumSize, form1.MinimumSize and perhaps form1.TopMost.

All of this options you can assign via Visual Studio Designer.
 
Share this answer
 
Comments
Olivier Levrey 17-May-11 8:40am    
Sure. 5.
Kim Togo 17-May-11 8:41am    
Thanks
If you want to show the small window on top,
use the code

smallwindow.ShowDialog(); //where smallwindow is your smaller form

instead of

smallwindow.Show();
 
Share this answer
 
v5
Comments
Olivier Levrey 17-May-11 8:36am    
This could help. 5.
Try starting the second form as a child of the first:
Form2 form2 = new Form2(Form1); // or new Form2(this) if called from within Form1

And make Form2's constructor take a parameter that is the parent form (and then set its own Owner property).

Alternatively, set the Owner property directly: form2.Owner = form1;.

Child forms are always shown on top of their parent. They are also automatically closed when the parent is closed.
 
Share this answer
 
v2
Comments
Olivier Levrey 17-May-11 8:40am    
Form class has only one constructor, and it is parameterless. I think you wanted to use the Parent property.
BobJanova 17-May-11 9:53am    
Oh, right you are. My brain slipped into Delphi mode again. I'll edit the solution. Thanks.

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