Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#始终在顶部例外_C#_Fullscreen_Always On Top - Fatal编程技术网

c#始终在顶部例外

c#始终在顶部例外,c#,fullscreen,always-on-top,C#,Fullscreen,Always On Top,我用了这个密码 namespace WindowsFormsApplication52 { public partial class Form1 : Form { static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); static readonly IntPtr HWND_TOP = new IntPtr(0

我用了这个密码

namespace WindowsFormsApplication52
{
public partial class Form1 : Form
{
    static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
    static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
    static readonly IntPtr HWND_TOP = new IntPtr(0);
    static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
    const UInt32 SWP_NOSIZE = 0x0001;
    const UInt32 SWP_NOMOVE = 0x0002;
    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);

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
    }
}
但有些应用程序仍然处于领先地位。我离开了任务管理器,但有时我想重新开始。我无法运行。我怎么修理它


一些最顶端的窗口比最顶端的窗口更顶端,因为它们只是到达顶端:)@AlexeiLevenkov creative solutions:)为什么要使用该代码??只需设置表单的最高属性,而不是重新发明轮子<代码>this.topmest=true它不工作。我还是试着关上它