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);

原文链接:

http://www.cnblogs.com/xchit/archive/2012/09/13/2683180.html

你可能感兴趣的:(WPF,最前端显示)