diff --git a/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.Designer.cs
new file mode 100644
index 000000000..98223ee91
--- /dev/null
+++ b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.Designer.cs
@@ -0,0 +1,64 @@
+namespace PKHeX.WinForms
+{
+ partial class BallBrowser
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.flp = new System.Windows.Forms.FlowLayoutPanel();
+ this.SuspendLayout();
+ //
+ // flp
+ //
+ this.flp.AutoSize = true;
+ this.flp.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flp.Location = new System.Drawing.Point(0, 0);
+ this.flp.Name = "flp";
+ this.flp.Size = new System.Drawing.Size(127, 88);
+ this.flp.TabIndex = 0;
+ //
+ // BallBrowser
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.ClientSize = new System.Drawing.Size(127, 88);
+ this.Controls.Add(this.flp);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "BallBrowser";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "BallBrowser";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flp;
+ }
+}
\ No newline at end of file
diff --git a/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.cs b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.cs
new file mode 100644
index 000000000..264ffcfec
--- /dev/null
+++ b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.cs
@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+using PKHeX.Core;
+using PKHeX.WinForms.Properties;
+
+namespace PKHeX.WinForms
+{
+ public partial class BallBrowser : Form
+ {
+ public BallBrowser() => InitializeComponent();
+
+ public int BallChoice { get; private set; } = -1;
+
+ public void LoadBalls(Ball[] poss, ICollection legal, IReadOnlyList names)
+ {
+ for (int i = 0; i < poss.Length; i++)
+ {
+ var pb = GetBallView(poss[i], legal, names);
+ flp.Controls.Add(pb);
+ const int width = 5; // balls wide
+ if (i % width == width - 1)
+ flp.SetFlowBreak(pb, true);
+ }
+ }
+
+ private PictureBox GetBallView(Ball b, ICollection legal, IReadOnlyList names)
+ {
+ var img = SpriteUtil.GetBallSprite((int) b);
+ var pb = new PictureBox
+ {
+ Size = img.Size,
+ Image = img,
+ BackgroundImage = legal.Contains(b) ? Resources.slotSet : Resources.slotDel,
+ BackgroundImageLayout = ImageLayout.Tile
+ };
+ pb.MouseEnter += (_, __) => Text = names.First(z => z.Value == (int) b).Text;
+ pb.Click += (_, __) => SelectBall(b);
+ return pb;
+ }
+
+ private void SelectBall(Ball b)
+ {
+ BallChoice = (int)b;
+ Close();
+ }
+ }
+}
diff --git a/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.resx b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/PKHeX.WinForms/Controls/PKM Editor/BallBrowser.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index c9a91e84c..ce7bd951a 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -239,7 +239,7 @@ private void LoadFieldsFromPKM(PKM pk, bool focus = true, bool skipConversionChe
pkm = pk.Clone();
try { GetFieldsfromPKM(); }
- finally { }
+ catch { }
Stats.UpdateIVs(null, EventArgs.Empty);
UpdatePKRSInfected(null, EventArgs.Empty);
@@ -607,43 +607,13 @@ private void ClickBall(object sender, EventArgs e)
.TakeWhile(z => (int) z <= pkm.MaxBallID).ToArray();
var names = GameInfo.BallDataSource;
- var frm = new Form
+ using (var frm = new BallBrowser())
{
- FormBorderStyle = FormBorderStyle.FixedToolWindow,
- StartPosition = FormStartPosition.CenterParent,
- AutoSize = true,
- AutoSizeMode = AutoSizeMode.GrowAndShrink,
- MaximizeBox = false,
- MinimizeBox = false,
- };
- var flp = new FlowLayoutPanel {AutoSize = true, Dock = DockStyle.Fill};
-
- for (int i = 0; i < poss.Length; i++)
- {
- var b = poss[i];
- var img = SpriteUtil.GetBallSprite((int) b);
- bool valid = legal.Contains(b);
- var pb = new PictureBox
- {
- Size = img.Size,
- Image = img,
- BackgroundImage = valid ? Resources.slotSet : Resources.slotDel,
- BackgroundImageLayout = ImageLayout.Tile
- };
- pb.MouseEnter += (_, __) => frm.Text = names.First(z => z.Value == (int)b).Text;
- pb.Click += (_, __) =>
- {
- CB_Ball.SelectedValue = (int)b;
- frm.Close();
- };
- flp.Controls.Add(pb);
- const int width = 5;
- if (i % width == width - 1)
- flp.SetFlowBreak(pb, true);
+ frm.LoadBalls(poss, legal, names);
+ frm.ShowDialog();
+ if (frm.BallChoice >= 0)
+ CB_Ball.SelectedValue = frm.BallChoice;
}
- frm.Controls.Add(flp);
- frm.ShowDialog();
- frm.Dispose();
}
private void ClickShinyLeaf(object sender, EventArgs e) => ShinyLeaf.CheckAll(ModifierKeys != Keys.Control);
diff --git a/PKHeX.WinForms/PKHeX.WinForms.csproj b/PKHeX.WinForms/PKHeX.WinForms.csproj
index 39cc8abf7..3c4d24bc7 100644
--- a/PKHeX.WinForms/PKHeX.WinForms.csproj
+++ b/PKHeX.WinForms/PKHeX.WinForms.csproj
@@ -147,6 +147,12 @@
+
+ Form
+
+
+ BallBrowser.cs
+
@@ -640,6 +646,9 @@
+
+ BallBrowser.cs
+
CatchRate.cs