保持窗口始终显示在屏幕(即便Win+D返回桌面)

Posted jizhiqiliao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了保持窗口始终显示在屏幕(即便Win+D返回桌面)相关的知识,希望对你有一定的参考价值。

解决方案:(其中 TopMost = true 便可使窗口保持最前端)

public mainFormHandler()
{
    InitializeComponent();
    // set TopMost
    this.TopMost = true;
}

private void mainFormHandler_SizeChanged(object sender, EventArgs e)
{
    if (this.WindowState == FormWindowState.Minimized)
    {
        this.WindowState = FormWindowState.Normal;
    }
    SetParent(this.Handle.ToInt32(), this.Handle.ToInt32());
}
[DllImport(
"user32.dll", EntryPoint = "SetParent")] public static extern int SetParent(int hWndChild, int hWndNewParent);

以上是关于保持窗口始终显示在屏幕(即便Win+D返回桌面)的主要内容,如果未能解决你的问题,请参考以下文章

windows 10常用快捷键举例

Win10新增快捷键

Win32获取屏幕句柄的函数是啥?

如何始终保持窗口可见,但不强制它位于顶部

如何优雅地使用Win10

解决电脑上网问题记录