mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-24 12:14:59 -05:00
Clamp scroll value set
Mono (Linux Mint) specific behavior; I guess 'NewValue' can be outside the range? Closes #2140
This commit is contained in:
@@ -97,12 +97,13 @@ public static void PanelScroll(object sender, ScrollEventArgs e)
|
||||
switch (e.ScrollOrientation)
|
||||
{
|
||||
case ScrollOrientation.HorizontalScroll:
|
||||
p.HorizontalScroll.Value = e.NewValue;
|
||||
p.HorizontalScroll.Value = Clamp(e.NewValue, p.HorizontalScroll);
|
||||
break;
|
||||
case ScrollOrientation.VerticalScroll:
|
||||
p.VerticalScroll.Value = e.NewValue;
|
||||
p.VerticalScroll.Value = Clamp(e.NewValue, p.VerticalScroll);
|
||||
break;
|
||||
}
|
||||
int Clamp(int value, ScrollProperties prop) => Math.Max(prop.Minimum, Math.Min(prop.Maximum, value));
|
||||
}
|
||||
|
||||
public static void DoubleBuffered(this DataGridView dgv, bool setting)
|
||||
|
||||
Reference in New Issue
Block a user