#110, #111, version 0.11.1.1

[BUG] ArgumentOutOfRangeException #110
[BUG] AutosizeRows when high dpi #111
This commit is contained in:
Markus Hofknecht 2020-06-22 21:52:35 +02:00
parent fe02510cf6
commit 65159276d7
2 changed files with 18 additions and 12 deletions

View file

@ -89,12 +89,15 @@ namespace SystemTrayMenu.Handler
internal void EnterOpensInstantly(DataGridView dgv, int rowIndex)
{
timerStartLoad.Stop();
StopLoadMenu.Invoke();
SetData(dgv, rowIndex);
MouseActive = false;
checkForMouseActive = false;
CallOpenMenuNow();
if (dgv.Rows.Count > rowIndex)
{
timerStartLoad.Stop();
StopLoadMenu.Invoke();
SetData(dgv, rowIndex);
MouseActive = false;
checkForMouseActive = false;
CallOpenMenuNow();
}
}
internal void MouseMove(object sender, MouseEventArgs e)

View file

@ -37,7 +37,6 @@ namespace SystemTrayMenu.UserInterface
private readonly Fading fading = new Fading();
private bool isShowing = false;
private bool dgvAutoResizeRowDone = false;
internal Menu()
{
@ -242,10 +241,14 @@ namespace SystemTrayMenu.UserInterface
internal void AdjustSizeAndLocation(Menu menuPredecessor = null,
bool directionToRight = false)
{
if (!dgvAutoResizeRowDone)
CheckForAutoResizeRowDone();
void CheckForAutoResizeRowDone()
{
dgv.AutoResizeRows();
dgvAutoResizeRowDone = true;
if (!(bool)dgv.Tag)
{
dgv.AutoResizeRows();
dgv.Tag = true;
}
}
int dgvHeightNeeded = dgv.Rows.GetRowsHeight(
@ -277,14 +280,14 @@ namespace SystemTrayMenu.UserInterface
{
if (directionToRight)
{
x = menuPredecessor.Location.X +
x = menuPredecessor.Location.X +
menuPredecessor.Width -
(int)Math.Round(Scaling.Factor, 0,
MidpointRounding.AwayFromZero);
}
else
{
x = menuPredecessor.Location.X -
x = menuPredecessor.Location.X -
Width +
(int)Math.Round(Scaling.Factor, 0,
MidpointRounding.AwayFromZero);