.NET认为屏幕是有序不同于Windows控制面板|显示|屏幕分辨率不 [英] .NET thinks screens are ordered differently than Windows Control Panel | Display | Screen Resolution does

查看:196
本文介绍了.NET认为屏幕是有序不同于Windows控制面板|显示|屏幕分辨率不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的事情,昨晚我看到运行Windows 7嵌入式标准的64位有2台显示器连接在电脑上。显示分辨率对话框显示的显示器作为显示器1和显示器2(从左至右)。当我运行一个程序我写了使用两个屏幕,我预计展出1的输出出现了最右边的显示屏上,我预期显示2的输出最左边的屏幕上出现了。

Weird thing I saw last night on a PC running Windows 7 Embedded Standard 64-bit with 2 monitors connected. The Display Resolution dialog shows the monitors as being display 1 and display 2 (from left to right). When I run a program I wrote that used both screens, the output I expected on display 1 showed up on the rightmost display, and the output I expected on display 2 showed up on the leftmost display.

花了一些时间在这里和谷歌,结束了使用一些code,我发现创建一个控制台应用程序显示的System.Windows.Forms.Screen.AllScreens的内容:

Spent some time here and on Google, and ended up using some code I found to create a console app that displayed the contents of the System.Windows.Forms.Screen.AllScreens:

// For each screen, add the screen properties to a list box.
foreach (var screen in System.Windows.Forms.Screen.AllScreens)
{
    Console.WriteLine("Device Name: " + screen.DeviceName);
    Console.WriteLine("Bounds: " +
        screen.Bounds.ToString());
    Console.WriteLine("Type: " +
        screen.GetType().ToString());
    Console.WriteLine("Working Area: " +
        screen.WorkingArea.ToString());
    Console.WriteLine("Primary Screen: " +
        screen.Primary.ToString());
}

运行它在一个测试机,并得到了我的预期 - AllScreens顺序显示分辨率对话框顺序相匹配

Ran it on one test machine and got what I expected -- AllScreens order matches the DIsplay Resolution dialog order.

但有问题的机器上,的code的输出上面出来了逆转。 DISPLAY1在那个是第二个屏幕(最右边)的位置,并且DISPLAY2被定位在最左边的屏幕

But on the problematic machine, the output of the code above came out reversed. DISPLAY1 was at a position that was the second screen (rightmost), and DISPLAY2 was positioned at the leftmost screen.

这真的很奇怪。因为这是用我的程序没有,它的东西,在.NET的内部结构。同样的code适用于其他类似的机器,所以我不认为这是一个普遍的问题,但隔离到本机的一个问题。我试着更多搜索类似的问题,但已经提出了空,可能是由于搜索词(监视器,屏幕,.NET所有符合什么都没有做这个问题的项目很多)。

That's really weird. Since this WASN'T using my program, it's something in the innards of .NET. The same code works on other similar machines, so I don't think it's a general problem, but is a problem isolated to this machine. I've tried more searching for similar problems but have come up empty, probably due to the search terms (monitor, screen, .NET all match a LOT of items that have nothing to do with this issue).

任何人都看到了这一点之前,最好,就如何解决它的想法?重新安装.NET 4包并没有帮助。改变显示分辨率对话框位置,然后更改它们背面没有帮助,甚至在两者之间重新启动。

Anyone seen this before, and ideally, have an idea on how to fix it? Reinstalling the .NET 4 package did not help. Changing locations in the Display Resolution dialog and then changing them back did not help, even with a reboot in between.

感谢。

推荐答案

AllScreens 属性通过的 EnumDisplayMonitors 功能。

The AllScreens property is populated via the EnumDisplayMonitors function.

的文档 EnumDisplayMonitors 不表示什么顺序返回了监视器,因此可以推断这是一个实现细节可以从操作系统版本操作系统版本改变。

The documentation for EnumDisplayMonitors does not indicate what order it returns the monitors in, thus one can infer it is an implementation detail which can change from OS version to OS version.

这篇关于.NET认为屏幕是有序不同于Windows控制面板|显示|屏幕分辨率不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆