Form creation sometimes lags behind main form

Asked

Viewed 149 times

1

Person,

I am creating my children in the following way.

BuscaUsuario _chld = new BuscaUsuario();
_chld.ShowDialog();
_chld.Dispose();

It turns out that if the user presses alt+tab or for example if I’m debugging and goes to IDE and then back to the application the child form is always behind the parent form.

There is a way that in the creation of the form obliges him to always be on top?

  • 1

    you can use the property TopMost from the form for this, take a look here if it satisfies you: https://msdn.microsoft.com/pt-br/library/system.windows.forms.form.topmost(v=vs.110).aspx. remembering that it will make the screen always be in front, even with alt tab as far as I can remember.

  • Martian, I tested the property but it’s not quite what I wanted, as you said the form is on top of everything including other windows that has nothing to do with the system.

  • I tried to play this behavior with alt+tab or debug but could not. When calling the child form with Showdialog, it will normally receive the focus and will always be in front of the form that called it. If your example can post the code of the Designer.Cs files it will help.

  • Ismael, try to do so to simulate. Creates 3 Mainform Forms, then a child and then another form for searching for example. When to press ALT+TAB If the focus is for the 2 form I won’t be able to touch the active form that would be the Search form. Is there a way to leave locked and whenever you require focus on the form it always sends the focus to the last open form? Thanks @Smael

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.