mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 14:45:36 -05:00
Fix Stat Editor randomize buttons centering
Hiding and Showing doesn't trigger an update to the FlowLayoutPanel's width; force a layout to happen so the size updates prior to re-centering controls. Only move if it is a different X coordinate (perf?)
This commit is contained in:
@@ -638,6 +638,8 @@ public void ToggleInterface(PKM pk, int gen)
|
||||
foreach (var mtb in MT_EVs)
|
||||
mtb.Visible = !showAV;
|
||||
|
||||
FLP_PKMEditors.PerformLayout();
|
||||
|
||||
var showGV = pk is IGanbaru;
|
||||
Label_GVs.Visible = showGV;
|
||||
foreach (var mtb in MT_GVs)
|
||||
|
||||
@@ -36,7 +36,8 @@ internal static void CenterToForm(this Control child, Control? parent)
|
||||
internal static void HorizontallyCenter(this Control child, Control parent)
|
||||
{
|
||||
int midpoint = (parent.Width - child.Width) / 2;
|
||||
child.SetBounds(midpoint, 0, 0, 0, BoundsSpecified.X);
|
||||
if (child.Location.X != midpoint)
|
||||
child.SetBounds(midpoint, 0, 0, 0, BoundsSpecified.X);
|
||||
}
|
||||
|
||||
public static T? FirstFormOfType<T>() where T : Form => (T?)Application.OpenForms.Cast<Form>().FirstOrDefault(form => form is T);
|
||||
|
||||
Reference in New Issue
Block a user