using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Flowframes.Ui { public static class ControlExtensions { [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern bool LockWindowUpdate(IntPtr hWndLock); public static void Suspend(this Control control) { LockWindowUpdate(control.Handle); } public static void Resume(this Control control) { LockWindowUpdate(IntPtr.Zero); } public static List GetControls(this Control control) { List list = new List(); var controls = control.Controls.Cast().ToList(); list.AddRange(controls); controls.ForEach(c => list.AddRange(c.GetControls())); return list; } } }