WPF popup is always TOP_MOST
来源:百度文库 编辑:神马文学网 时间:2024/05/16 18:10:38
Hmmm... WPF popup is always TOP_MOST
Recently I have this bug inherited from my good intern that WPF
[DllImport("user32", EntryPoint = "SetWindowPos")]
private static extern int SetWindowPos(IntPtr hwnd, int hwndInsertAfter, int x, int y, int cx, int cy, int wFlags);
{
...
protected override void OnOpened(EventArgs e)
{
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(this.Child)).Handle;
SetWindowPos(hwnd, -2, posX, posY, (int)this.Width, (int)this.Height, 0);
}
}