Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hey,
i have none mdi form which opens other forms in his borders.
the other forms is set to topmost = true otherwise i want be able to see them immidiatly. the problem is when i open, for example, the browser and the main form stays under the browser but the other forms which set to topmost = true stay above and thats not what i want. i guess i can put my main form in topmost = true but i dont want to force myself on the client. any idea on how to make the other forms shown without make them top level or even better, cath the main form event when other folder gets above him?
Posted

[EDIT]

After the clarifications in comments below:

I don't think anything you really need to use Topmost. Now I can see that your concerns are two different things 1) Z-order behavior of forms, 2) showing a form in a task bar.

First of all, you most likely forgot one very important thing related to top order which is often overlooked (probably because documentation is unclear about it). Try this:
C#
myForm.Owner = myMainForm;
myForm.ShowInTaskbar = false; // often should come with ownership 

If this code is to be written in the class of myForm, replace myForm.* with this.*. Even if this is not exactly what you want, do it and then see how it behaves. It will either give you a final solution or will help you to understand how things work and will leads you to the solution.

—SA
 
Share this answer
 
v2
Comments
oronsultan 10-May-15 13:57pm    
hey again sergey!
first, thanks for the reply of you and dave. now, regarding to my Q, let me be more specific:
for start, the main form is not! MDI. i dont sure u remember but we had this discussion a few month ago and i decided to listen to you.
in my program, i have a main form and some other forms opened from the main form. when i open a form from the main form, i have 2 forms shown on the task bar and so on but only the main form is seen. when i click the second form from the task bar, then it shown on the screen. now, in a situation when my secondary form is set to topmost = true, when i open it, it will show on top of the main form (the main form is larger then all of the other forms so it seems like its a window inside the main form). when i set the topmost of the secondary form to False, after the Load event, the form stays in the taskbar even if i set his 'form.Location' event to a new point on the screen.
there is a lot of dissadvantage in puting the main form in topmost = true. for example, when other folder in the OS is open, the form stays above all and the client can get appset because of that. what that i looking for is a way to load all the other forms and when thay finished loading thay will be visible on the main screen and not in the task bar.
thanks!
Sergey Alexandrovich Kryukov 10-May-15 14:43pm    
I did not think that you used MDI, maybe Dave did, I don't know.
Thank you for the clarifications; please see the update to the answer.
—SA
Sergey Alexandrovich Kryukov 10-May-15 14:46pm    
Also, please tell us what is your given and family name; what's more appropriate addressing to you, Oron, Sultan, or something else? It's always good to define your signature in your CodeProject profiles and/or posts.
—SA
oronsultan 10-May-15 15:44pm    
dear dear sergey,
your answer above seems like the answer. i'll be in my office and will give it a shot tommorow morning. its seems like you gave me an answer to somthing i didnt know that exist: hide a form in the taskbar :-) plus the owner problem.
i will keep you update in about 10 hours...
btw, first name is oron but my friends call me Bond, james bond... :-)
Sergey Alexandrovich Kryukov 10-May-15 16:18pm    
Thank you. If it gets your the solution, please don't forget to accept the answer formally. If not yet, please explain further detail.
—SA
You're not describing the problem or what you want very clearly at all so I'm just guessing.

First and foremost, do NOT use MDI!! It sounds like you're trying to use MDI for something it wasn't designed for an it's hampering you. Remove all the MID crap and try your work again without it. You may find things work much better.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-May-15 14:45pm    
Not that Oron did not try to use MDI in first place. He remembers that I convinced him before to avoid it. :-)
— please see his comment to my answer and the question itself.
—SA

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