如何使窗口始终位于.Net顶部?(任务视图)

时间:2018-09-13 07:29:21

标签: c# topmost

我为我的学校制定了安全计划。我需要的, 在允许之前,我会保留Windows表单。 我可以部分地使用以下代码。

<code>
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
private const UInt32 SWP_NOSIZE = 0x0001;
private const UInt32 SWP_NOMOVE = 0x0002;
private const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;

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

SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);</code>

但是 上面的代码。 在任务视图中不起作用(Windows 10) preview

0 个答案:

没有答案