Showing a form without focus

  • Thread starter Thread starter Luke R
  • Start date Start date
L

Luke R

How do i do this?

I have this at the top of the class for my form, but it doesnt work.

Protected Overrides ReadOnly Property ShowWithoutActivation() As Boolean
Get
Return True
End Get
End Property

Any ideas? At the moment i show the form and then call the Focus method on
the calling form, but its tacky. The called form is topmost, but taking that
off doesnt do anything - it still steals focus.
 
I just checked and standard form.Show method does that properly.

I use code like this:

void SomeFormEventHandler(object sender, ...) {
...
SecondForm f = new SecondForm();
f.Show((IWin32Window)this);
...
}

SecondForm is shown without focus - original form stays focused.

However I found that even if main form is TopMost = true, new forms can
cover it when shown.
Otherwise it works without additional tricks.

Can you post your code, which doesn't keep focus in calling form?
 
Back
Top