2010-01-28 53 views

回答

8

由於提出了這個問題,我一直在研究這個問題,並且遇到了一個很好的例子,說明如何通過p /在'user32.dll'中調用SetWindowPos來達到這個目的。如果這有效,我會回來接受這個答案。

[DllImport("user32.dll")] 
    static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); 

    static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); 

    const UInt32 SWP_NOSIZE = 0x0001; 
    const UInt32 SWP_NOMOVE = 0x0002; 
    const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE; 

    public static void MakeTopMost (IntPtr hWnd) 
    { 
     SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); 
    } 
相關問題