mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-27 18:40:32 +12:00
Fix using direction when reach screen border (#94)
This commit is contained in:
parent
b2937153c9
commit
fd34b400e1
|
@ -757,7 +757,7 @@ namespace SystemTrayMenu.Business
|
||||||
widthPredecessors -= newWith;
|
widthPredecessors -= newWith;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.AdjustSizeAndLocation(menuPredecessor);
|
menu.AdjustSizeAndLocation(menuPredecessor, directionToRight);
|
||||||
widthPredecessors += menu.Width - menu.Padding.Left;
|
widthPredecessors += menu.Width - menu.Padding.Left;
|
||||||
menuPredecessor = menu;
|
menuPredecessor = menu;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,8 @@ namespace SystemTrayMenu.UserInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AdjustSizeAndLocation(Menu menuPredecessor = null)
|
internal void AdjustSizeAndLocation(Menu menuPredecessor = null,
|
||||||
|
bool directionToRight = false)
|
||||||
{
|
{
|
||||||
if (!dgvAutoResizeRowDone)
|
if (!dgvAutoResizeRowDone)
|
||||||
{
|
{
|
||||||
|
@ -272,9 +273,24 @@ namespace SystemTrayMenu.UserInterface
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = menuPredecessor.Location.X - Width +
|
if (directionToRight)
|
||||||
(int)Math.Round(Scaling.Factor, 0,
|
{
|
||||||
MidpointRounding.AwayFromZero);
|
x = menuPredecessor.Location.X + Width -
|
||||||
|
(int)Math.Round(Scaling.Factor, 0,
|
||||||
|
MidpointRounding.AwayFromZero);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = menuPredecessor.Location.X - Width +
|
||||||
|
(int)Math.Round(Scaling.Factor, 0,
|
||||||
|
MidpointRounding.AwayFromZero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
x += menuPredecessor.Width;
|
||||||
|
x += Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
|
|
Loading…
Reference in a new issue