You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace demo.ClassHelper
|
|
{
|
|
public class ControlHelper
|
|
{
|
|
public static void Enable(Control[] controls)
|
|
{
|
|
foreach (Control ctl in controls)
|
|
{
|
|
ctl.Enabled = true;
|
|
}
|
|
}
|
|
|
|
public static void Enable(Control control)
|
|
{
|
|
if (control.Controls.Count > 0)
|
|
{
|
|
foreach (Control ctl in control.Controls)
|
|
{
|
|
Enable(ctl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
control.Enabled = true;
|
|
}
|
|
}
|
|
|
|
public static void DisEnable(Control[] controls)
|
|
{
|
|
foreach (Control ctl in controls)
|
|
{
|
|
ctl.Enabled = false;
|
|
}
|
|
}
|
|
|
|
public static void Disable(Control control)
|
|
{
|
|
if (control.Controls.Count > 0)
|
|
{
|
|
foreach (Control ctl in control.Controls)
|
|
{
|
|
Disable(ctl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
control.Enabled = false;
|
|
}
|
|
}
|
|
}
|
|
}
|