在任务栏(使用双显示器)前WPF窗口,我该怎么办呢?我该、任务栏、显示器、窗口

2023-09-06 17:26:11 作者:无心小姐

我想创建一个双显示器的应用程序。所以,我达到这个目标有以下code:

I'm trying to create a dual monitor app. So, i reach this goal with the following code:

var myWindow = new MyWindow();

var workingArea = System.Windows.Forms.Screen.AllScreens[selectedMonitor].WorkingArea;
myWindow.Top = workingArea.Top;
myWindow.Left = workingArea.Left;
myWindow.Height = workingArea.Height;
myWindow.Width = workingArea.Width;
myWindow.Show();

如果我传递给 selectedMonitor 的值为1,应用程序将在第二个显示器打开,一切都很好,但是当我传递值0,应用程序打开在第一个监视器,但Windows任务栏的应用程序的前面。

If i pass to selectedMonitor the value 1, the app is opened in the second monitor, everything is ok, but when i pass the value 0, the app is opened in the first monitor, but the windows taskbar is in front of the app.

我怎样才能把 mywindow的在任务栏的前面?

How can i put the myWindow in front of taskbar?

推荐答案

如果您设置了 WindowStyle (所以它没有边界),并设定的WindowState 最大化或手动设置的大小,它的会在任务栏的前面。如果你想在标题栏和诸如此类的东西,我不知道你可以做些什么。

If you set the WindowStyle to None (so it doesn't have a border) and set the WindowState to Maximized or set the sizing manually, it'll be in front of the taskbar. If you want the titlebar and whatnot, I'm not sure what you can do.

此外, WorkingArea 不包括在标题栏的区域。该文档具体说它排除了。所以,你不希望出现这种情况无论是。你可能只是想