From ceff3845b792f13a84847162d04c2465fc94f21e Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 20:57:45 -0700 Subject: [PATCH] Add TableLayoutPanel scroll hack Thanks @poutros ! --- MainWindow/Main.cs | 2 +- Subforms/PKM Editors/RibbonEditor.cs | 2 ++ Subforms/PKM Editors/SuperTrainingEditor.cs | 2 ++ Subforms/Save Editors/SAV_EventFlags.cs | 5 +++-- Util/FormUtil.cs | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 8e7356986..bdf4b2116 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -86,7 +86,7 @@ namespace PKHeX // Box to Tabs D&D dragout.AllowDrop = true; - FLP_SAVtools.Scroll += Util.FlowLayoutPanelScroll; + FLP_SAVtools.Scroll += Util.PanelScroll; // Load WC6 folder to legality refreshWC6DB(); diff --git a/Subforms/PKM Editors/RibbonEditor.cs b/Subforms/PKM Editors/RibbonEditor.cs index 1a8ad5292..fc73bd0a0 100644 --- a/Subforms/PKM Editors/RibbonEditor.cs +++ b/Subforms/PKM Editors/RibbonEditor.cs @@ -16,6 +16,8 @@ namespace PKHeX // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_Ribbons.SuspendLayout(); + FLP_Ribbons.Scroll += Util.PanelScroll; + TLP_Ribbons.Scroll += Util.PanelScroll; populateRibbons(); Util.TranslateInterface(this, Main.curlanguage); TLP_Ribbons.ResumeLayout(); diff --git a/Subforms/PKM Editors/SuperTrainingEditor.cs b/Subforms/PKM Editors/SuperTrainingEditor.cs index af930afb1..5f148bb31 100644 --- a/Subforms/PKM Editors/SuperTrainingEditor.cs +++ b/Subforms/PKM Editors/SuperTrainingEditor.cs @@ -16,6 +16,8 @@ namespace PKHeX // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_SuperTrain.SuspendLayout(); TLP_DistSuperTrain.SuspendLayout(); + TLP_SuperTrain.Scroll += Util.PanelScroll; + TLP_DistSuperTrain.Scroll += Util.PanelScroll; populateRegimens("SuperTrain", TLP_SuperTrain, reglist); populateRegimens("DistSuperTrain", TLP_DistSuperTrain, distlist); Util.TranslateInterface(this, Main.curlanguage); diff --git a/Subforms/Save Editors/SAV_EventFlags.cs b/Subforms/Save Editors/SAV_EventFlags.cs index acb7234e8..006653a9c 100644 --- a/Subforms/Save Editors/SAV_EventFlags.cs +++ b/Subforms/Save Editors/SAV_EventFlags.cs @@ -24,9 +24,10 @@ namespace PKHeX CB_Stats.Items.Add(i.ToString()); TLP_Flags.SuspendLayout(); - TLP_Flags.Controls.Clear(); - TLP_Const.SuspendLayout(); + TLP_Flags.Scroll += Util.PanelScroll; + TLP_Const.Scroll += Util.PanelScroll; + TLP_Flags.Controls.Clear(); TLP_Const.Controls.Clear(); addFlagList(getStringList("flags")); addConstList(getStringList("const")); diff --git a/Util/FormUtil.cs b/Util/FormUtil.cs index e0c9da540..c76a198d9 100644 --- a/Util/FormUtil.cs +++ b/Util/FormUtil.cs @@ -139,9 +139,9 @@ namespace PKHeX return (int)(cb?.SelectedValue ?? 0); } - public static void FlowLayoutPanelScroll(object sender, ScrollEventArgs e) + public static void PanelScroll(object sender, ScrollEventArgs e) { - var p = sender as FlowLayoutPanel; + var p = sender as Panel; switch (e.ScrollOrientation) { case ScrollOrientation.HorizontalScroll: