[Main] - Fix issues regarding to multi-monitor.

This commit is contained in:
Ivandro Ismael 2017-02-17 19:48:46 +00:00
parent 7818b1f915
commit 683c01ed9c

View File

@ -1081,17 +1081,19 @@ namespace Nikse.SubtitleEdit.Forms
}
}
var screen = Screen.FromControl(this);
var ctrlScreen = Screen.FromControl(this);
if (screen.Bounds.Width < Width)
Width = screen.Bounds.Width;
if (screen.Bounds.Height < Height)
Height = screen.Bounds.Height;
if (ctrlScreen.Bounds.Width < Width)
Width = ctrlScreen.Bounds.Width;
if (ctrlScreen.Bounds.Height < Height)
Height = ctrlScreen.Bounds.Height;
if (screen.Bounds.X + screen.Bounds.Width - 200 < Left)
Left = screen.Bounds.X + screen.Bounds.Width - Width;
if (screen.Bounds.Y + screen.Bounds.Height - 100 < Top)
Top = screen.Bounds.Y + screen.Bounds.Height - Height;
// Fix main window coordinate (Multi-Monitor issue)
if ((ctrlScreen.Bounds.Right < Left) || (ctrlScreen.Bounds.Bottom < Top) ||
(ctrlScreen.Bounds.X > Right) || (ctrlScreen.Bounds.Y > Top))
{
CenterToScreen();
}
}
else
{