From b01ec96ac8a3e3c1d4eae8d0e2c6f627ef52693a Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 11 Jun 2022 09:37:44 -0700 Subject: [PATCH] Dispose of discarded slots when adding new --- PKHeX.WinForms/Controls/Slots/PokeGrid.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PKHeX.WinForms/Controls/Slots/PokeGrid.cs b/PKHeX.WinForms/Controls/Slots/PokeGrid.cs index 954a1b3ce..2fd5f0103 100644 --- a/PKHeX.WinForms/Controls/Slots/PokeGrid.cs +++ b/PKHeX.WinForms/Controls/Slots/PokeGrid.cs @@ -17,8 +17,8 @@ public PokeGrid() public readonly List Entries = new(); public int Slots { get; private set; } - private int sizeW = 40; - private int sizeH = 30; + private int sizeW = 68; + private int sizeH = 56; public bool InitializeGrid(int width, int height, SpriteBuilder info) { @@ -44,6 +44,8 @@ private void Generate(int width, int height) { SuspendLayout(); Controls.Clear(); + foreach (var c in Entries) + c.Dispose(); Entries.Clear(); int colWidth = sizeW; @@ -77,8 +79,8 @@ public static PictureBox GetControl(int width, int height) => new() AutoSize = false, SizeMode = PictureBoxSizeMode.CenterImage, BackColor = SlotUtil.GoodDataColor, - Width = width + (2 * 1), - Height = height + (2 * 1), + Width = width + (2 * border), + Height = height + (2 * border), Padding = Padding.Empty, Margin = Padding.Empty, BorderStyle = BorderStyle.FixedSingle,