mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 08:27:44 +01:00
35 lines
952 B
C#
35 lines
952 B
C#
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<Control> GetControls(this Control control)
|
|
{
|
|
List<Control> list = new List<Control>();
|
|
var controls = control.Controls.Cast<Control>().ToList();
|
|
list.AddRange(controls);
|
|
controls.ForEach(c => list.AddRange(c.GetControls()));
|
|
return list;
|
|
}
|
|
}
|
|
}
|