mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-12 06:37:20 -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:
parent
16dcef13a6
commit
c8d874462c
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user