Showing a form without focus

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.
 
A

AlexS

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top