代码以奇怪的消息退出

时间:2011-02-06 19:14:23

标签: c# .net visual-studio arrays nomethoderror

这是我的代码,我有两个显示器。

try
{
    Screen[] allScreens = Screen.AllScreens;
    Console.WriteLine("count=" + allScreens.Count());
    var b = allScreens[0];
    Console.WriteLine("first=" + b);
    var c = allScreens[1];
    Console.WriteLine("second=" + c);
}
catch (Exception e)
{
    Console.WriteLine("e=" + e);
    throw;
}

输出

count=2
first=Screen[Bounds={X=-1280,Y=0,Width=1280,Height=1024} WorkingArea={X=-1280,Y=0,Width=1280,Height=996} Primary=False DeviceName=\\.\DISPLAY1The program '[1168] WindowsFormsApplication1.vshost.exe: Program Trace' has exited with code 0 (0x0).

为什么我无法获得第二个屏幕以及为什么在控制台中只有这个奇怪的文本没有错误/异常?

0 个答案:

没有答案