How do I prevent a popup form from taking focus from the parent
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#, .n开发者_如何学运维et 2.0, system.windows.forms
Paste this into your popup form class, it prevents it from being activated when shown:
protected override bool ShowWithoutActivation {
get { return true; }
}
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
ShowWindow(popupForm.Handle, 8);
See ShowWindow Function for additional commands.
精彩评论