nicodevil
nicodevil

Reputation: 11

C# - Don't bring form to front

My apps use a timer that display a form after some seconds. When I minimize my apps to do other stuff, the timer is still active (I'm ok with that) and the form bring to front over all my windows with focus on it (normal behavior).

I want that the new form open above my main apps but not above all my windows.

In the main form, I call the new form like this :

MRIS.EVENT_BOX form1 = new MRIS.EVENT_BOX();
form1.Owner = this;
form1.ShowDialog();

I manage to remove the focus problem by adding this in the EVENT_BOX :

protected override bool ShowWithoutActivation { get { return true; } }

I also check that TopMost is set to false in the new form.

But the new form is still show above all the others (without focus this time...).

I check some other questions but cannot manage to find something useful.

Some people talk about visible form ?

If you can help me ?

Thanks

Upvotes: 0

Views: 646

Answers (1)

Mairaj Ahmad
Mairaj Ahmad

Reputation: 14604

You need to call form1.Show(); if you don't want to bring it to front

form1.Show();
//form1.BringToFront() You may need to call this if you want to being it to front

form1.ShowDialog() shows the form as dialog which means it will be shown on top of parent form. You can check more details on this here

Upvotes: 1

Related Questions