1
ドッキング機能を備えたアプリケーションでは、デスクトップを別のモニタ上のウィンドウを含むすべてのウィンドウの位置に保存できます。マルチモニタアプリケーションが欠落しているモニタを検出する方法
保存されたデスクトップが再読み込みされても、1つ以上のモニタが接続されていない場合、アプリケーションはこれを検出する必要があります。
...
Windows windows = Window.GetWindow(pane);
if (window != null)
{
PaneTookWindow = toolWindow = window.Content as PaneToolWindow;
if (toolWindow != null)
{
if (!AreaInScreenBounds(new Rect(toolWindow.Left, toolWindow.Top, toolWindow.Width, toolWindow.Height)))
{
pane.ExecuteCommand(ContentPaneCommands.ChangeToDocument);
}
}
}
...
private static bool AreaInScreenBounds(Rect area)
{
if (Application.Current != null && Application.Current.MainWindow != null)
{
Rect [] screeAreas = Application.Current.MainWindow.GetScreenAreas();
return screenAreas.Any(screen => screen.Contains(area));
}
return false;
}
問題は、この方法では、モニターが使用できなくなったかどうかを検出しませんということですが、エリア外メイン・ウィンドウ領域のであるかどうか: は、私は次のよう持っています。
接続されていないモニタや使用できなくなった領域を検出する方法はありますか?
なぜ数の減少についてあなたが唯一心配していますモニター?単一のモニターで画面の解像度を下げるなどの単純なことは、永続化されたウィンドウのサイズの復元に問題を引き起こす可能性があります。 –
WPFとウィンドウをレイアウトする方法では、異なる画面解像度が問題になるはずはありません。固定ピクセル位置はどこにもありません。 – tobre