|
-
Jan 31st, 2006, 05:28 AM
#1
Thread Starter
PowerPoster
forcing form infront[Resolved]
Hi
Was wondering if it is possible in C# to make a form stay infront of another form until they press a button or close the dialog properly?
For example, in MessageBox's - if you try to click on the form behind the MessageBox, it will not allow you to until you click the appropriate button on the MessageBox.
Many thanks!
Last edited by Techno; Feb 1st, 2006 at 12:12 PM.
-
Jan 31st, 2006, 05:30 AM
#2
Re: forcing form infront
set its TopMost property to True, and use it as a dialog .ShowDialog
-
Jan 31st, 2006, 05:32 AM
#3
Re: forcing form infront
Just use ShowDialog(). If you use TopMost as well, they won't be able to see some other applications because your form will be in their way (since it puts it at the top of all windows) which is very annoying.
-
Jan 31st, 2006, 06:00 PM
#4
Thread Starter
PowerPoster
Re: forcing form infront
ok ill give the top most a shot and see what happens.
anything else?
-
Jan 31st, 2006, 06:10 PM
#5
Thread Starter
PowerPoster
Re: forcing form infront
Ok, that top most is cool but I wanna go a step further.
When the user clicks on the previous/behind form from this top most form, i dont want them to use/click the behind form at all - like a message box.
I also do not want to hide/show the main form - pretty much I would like it the way it acts on a MessageBox
-
Jan 31st, 2006, 06:35 PM
#6
Thread Starter
PowerPoster
Re: forcing form infront
ShowDialog(); seems to do the trick
-
Feb 1st, 2006, 05:10 AM
#7
Re: forcing form infront
I would still recommend not using TopMost. It's not very user friendly and I tend to uninstall anything that does that because I like to work in multiple applications.
Also, please mark your thread as resolved.
-
Feb 1st, 2006, 05:15 AM
#8
Re: forcing form infront
ShowDialog and TopMost are intended for two quite different purposes. ShowDialog creates a modal dialogue, which is what it sounds like is needed here, where the user cannot access the calling form until the dialogue is dismissed. Using the TopMost property is good when you need the user to be able to see your application while working in another, like Task Manager. Like Task Manager again, it is always polite to provide an option to turn off that behaviour that would set your Form's TopMost property back to False.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|