Make Form always on top and can't Focus off

Im done with my application im making and now just tidying up little bits before i release it for beta but one problem ive came across that i can't work out or find on the internet to fix is:

I Have a About Form and a Change Log form which get selected from the Help Menu.

How can i make it so when i click on the forms it locks them so people cant click on the main form and have to click ok to close the form before they can use the main form again rather then them clicking on the main form and hiding the about and change log form.

If you can just give me a link to somewhere where i can read about it. would be great not asking to do my code unless it just 1 line.

Re: Make Form always on top and can't Focus off

Posted 17 July 2009 - 12:35 PM

i dont want it be be able to lose focus like on certian applications when you click say the about form and you cant do anything else on the main form till you click ok on the about form. ive got the form popping up and closing you btnOK to close the window. but someone can just load up the about form and then click back on the main form and continue what they were doing which makes the about form hide behind the main form

Re: Make Form always on top and can't Focus off

Posted 17 July 2009 - 01:01 PM

there must be an event that fires when the form loses focus.
just put this.TopMost = true; in that event
if there is no event you can make another thread run a loop and set the form topmost, and pause for a few miliseconds so your not using a billion cpu
if this.TopMost = true doesnt work, use the SetForegroundWindow api

Re: Make Form always on top and can't Focus off

Posted 17 July 2009 - 05:21 PM

Just to clarify. If you want a form, like the OpenDialogForm that when it opens the user can not switch back to the original window, all you have to do is what janne_panne said. You use ShowDialog instead of Show. ShowDialog creates a modal form for the application. The user has to close it before they can get back to working in the original window.

Re: Make Form always on top and can't Focus off

Posted 18 July 2009 - 05:56 AM

For my about screens I use .ShowDialog() and call this.BringToFront() when the form is shown so it blinks the application window in the task bar. It seems like you're trying to make this dialog very noticeable so perhaps that will help