[英]How do I prevent a popup form from taking focus from the parent
我有一個很小的windows.form,當鼠標懸停在windows.form的某個區域上時,我會用它來顯示信息,但是當它設置為可見時,它將從父窗口獲取焦點。 有什么方法可以防止這種情況-當它在焦點和焦點之間切換時,會導致主要形式閃爍。
c#、. net 2.0,system.windows.forms
將其粘貼到您的彈出表單類中,以防止其在顯示時被激活:
protected override bool ShowWithoutActivation {
get { return true; }
}
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
ShowWindow(popupForm.Handle, 8);
有關其他命令,請參見ShowWindow函數 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.