mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-20 19:30:31 +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;
|
||||
}
|
||||
|
||||
menu.AdjustSizeAndLocation(menuPredecessor);
|
||||
menu.AdjustSizeAndLocation(menuPredecessor, directionToRight);
|
||||
widthPredecessors += menu.Width - menu.Padding.Left;
|
||||
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)
|
||||
{
|
||||
|
@ -272,9 +273,24 @@ namespace SystemTrayMenu.UserInterface
|
|||
}
|
||||
else
|
||||
{
|
||||
x = menuPredecessor.Location.X - Width +
|
||||
(int)Math.Round(Scaling.Factor, 0,
|
||||
MidpointRounding.AwayFromZero);
|
||||
if (directionToRight)
|
||||
{
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue