0

私が書いたシンプルなスクリーンセーバーがあり、これは当社のすべてのクライアントPCに展開されています。

ほとんどのPCにはデュアルモニターが搭載されているため、スクリーンセーバーが両方のディスプレイで実行されるように注意しました。

これは正常に機能しますが、プライマリ画面が(左側のモニターに)スワップされている一部のシステムでは、スクリーンセーバーは左側(プライマリ)画面でのみ機能します。

問題のあるコードは以下のとおりです。誰かが私が間違ったことをしたこと、またはこれを処理するためのより良い方法を見ることができますか?

参考までに、「これ」のコンテキストは、スクリーンセーバーフォーム自体です。

// Make form full screen and on top of all other forms

int minY = 0;
int maxY = 0;
int maxX = 0;
int minX = 0;

foreach (Screen screen in Screen.AllScreens)
{
    // Find the bounds of all screens attached to the system

    if (screen.Bounds.Left < minX)
        minX = screen.Bounds.Left;

    if (screen.Bounds.Width > maxX)
        maxX = screen.Bounds.Width;

    if (screen.Bounds.Bottom < minY)
        minY = screen.Bounds.Bottom;

    if (screen.Bounds.Height > maxY)
        maxY = screen.Bounds.Height;
}

// Set the location and size of the form, so that it
// fills the bounds of all screens attached to the system

Location = new Point(minX, minY);
Height = maxY - minY;
Width = maxX - minX;
Cursor.Hide();
TopMost = true;
4

1 に答える 1

3

screen.Bounds.Rightではなくチェックしたいscreen.Bounds.Width

高さについても同様。

于 2009-12-18T20:18:53.873 に答える