Skip to content

Commit

Permalink
better handling of change in virtual screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Mar 17, 2016
1 parent af7f105 commit 7f93cf0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions AEMManager/util/SystemUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ public static void RestoreWindowPos(Form pfrm, int left = 0, int top = 0, int wi
key.Close();
}

if (pfrm.Left > SystemInformation.VirtualScreen.Width - 50) {
pfrm.Left = left > 0 ? left : 10;
if (pfrm.FormBorderStyle == FormBorderStyle.Sizable || pfrm.FormBorderStyle == FormBorderStyle.SizableToolWindow) {
if (pfrm.Width > SystemInformation.VirtualScreen.Width) {
pfrm.Width = SystemInformation.VirtualScreen.Width - 20;
}
if (pfrm.Height > SystemInformation.VirtualScreen.Height) {
pfrm.Height = SystemInformation.VirtualScreen.Height - 20;
}
}
if (pfrm.Left + pfrm.Width > SystemInformation.VirtualScreen.Width) {
pfrm.Left = SystemInformation.VirtualScreen.Width - pfrm.Width - 10;
}
if (pfrm.Top > SystemInformation.VirtualScreen.Height - 50) {
pfrm.Top = top > 0 ? top : 10;
if (pfrm.Top + pfrm.Height > SystemInformation.VirtualScreen.Height) {
pfrm.Top = SystemInformation.VirtualScreen.Height - pfrm.Height - 10;
}

}
Expand Down

0 comments on commit 7f93cf0

Please sign in to comment.