views:

39

answers:

2

I have a small windows.form that I use to present information when the mouse is over a regions on a windows.Form, however it takes the focus from the parent window when it is set to visible. Is there w way of preventing this - it causes the main form to flicker as it toggles between in focus and out.

c#, .net 2.0, system.windows.forms

+5  A: 

Paste this into your popup form class, it prevents it from being activated when shown:

    protected override bool ShowWithoutActivation {
        get { return true; }
    }
Hans Passant
+1 good tip, never noticed it's there.
Jaroslav Jandek
Agreed, took me three years to discover that one :)
Hans Passant
A: 
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

ShowWindow(popupForm.Handle, 8);

See ShowWindow Function for additional commands.

Jaroslav Jandek