WPF设置窗体最前端显示

  [DllImport("user32.dll")]
        private static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
        static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
        const int SWP_SHOWWINDOW = 0x0040;

在load下面代码:

     //Join WinAPI Setting Focse();  
            IntPtr handle = new WindowInteropHelper(this).Handle;

            SetWindowPos(handle, HWND_TOPMOST, 0, 0, 100, 200, SWP_SHOWWINDOW); 

原文地址:https://www.cnblogs.com/xchit/p/2683180.html