#region//控件类
public class PubliClass
{
/// <summary>
/// 清空控件内容
/// </summary>
public static void delContent(Control control)
{
foreach (Control ct in control.Controls)
{
Type tp = ct.GetType();
if (tp.Name == "TextEdit")
{
((TextEdit)ct).EditValue = null;
}
else if (tp.Name == "LookUpEdit")
{
((LookUpEdit)ct).EditValue = null;
((LookUpEdit)ct).ClosePopup();
}
else if (tp.Name == "CheckEdit")
{
((CheckEdit)ct).Checked = false;
}
//else if (tp.Name == "TextBox")
//{
// ((TextBox)ct).Text = null;
//}
else if (tp.Name == "SpinEdit")
{
((SpinEdit)ct).Value = decimal.Zero;
}
else if (tp.Name == "MemoEdit")
{
((MemoEdit)ct).Text = null;
}
else if (tp.Name == "DateEdit")
{
((DateEdit)ct).EditValue = null;
}
else if (tp.Name == "ListBoxControl")
{
((ListBoxControl)ct).SelectedItem = null;
}
else if (tp.Name == "RadioGroup")
{
((RadioGroup)ct).SelectedIndex = int.MinValue;
}
}
}
/// <summary>
/// 控件可用
/// </summary>
public static void EditableIS(Control control)
{
foreach (Control ct in control.Controls)
{
Type tp = ct.GetType();
if (tp.Name == "TextEdit")
{
((TextEdit)ct).Enabled = true;
}
else if (tp.Name == "LookUpEdit")
{
((LookUpEdit)ct).Enabled = true;
}
else if (tp.Name == "CheckEdit")
{
((CheckEdit)ct).Enabled = true;
}
//else if (tp.Name == "TextBox")
//{
// ((TextBox)ct).Enabled = true;
//}
else if (tp.Name == "SimpleButton")
{
((SimpleButton)ct).Enabled = true;
}
else if (tp.Name == "ListBoxControl")
{
((ListBoxControl)ct).Enabled = true;
}
else if (tp.Name == "DateEdit")
{
((DateEdit)ct).Enabled = true;
}
else if (tp.Name == "RadioGroup")
{
((RadioGroup)ct).Enabled = true;
}
else if (tp.Name == "MemoEdit")
{
((MemoEdit)ct).Enabled = true;
}
}
}
/// <summary>
/// 控件不可用
/// </summary>
public static void EditableNO(Control control)
{
foreach (Control ct in control.Controls)
{
Type tp = ct.GetType();
if (tp.Name == "TextEdit")
{
((TextEdit)ct).Enabled = false;
}
else if (tp.Name == "LookUpEdit")
{
((LookUpEdit)ct).Enabled = false;
}
else if (tp.Name == "CheckEdit")
{
((CheckEdit)ct).Enabled = false;
}
//else if (tp.Name == "TextBox")
//{
// ((TextBox)ct).Enabled = false;
//}
else if (tp.Name == "SimpleButton")
{
((SimpleButton)ct).Enabled = false;
}
else if (tp.Name == "ListBoxControl")
{
((ListBoxControl)ct).Enabled = false;
}
else if (tp.Name == "DateEdit")
{
((DateEdit)ct).Enabled = false;
}
else if (tp.Name == "RadioGroup")
{
((RadioGroup)ct).Enabled = false;
}
else if (tp.Name == "MemoEdit")
{
((MemoEdit)ct).Enabled = false;
}
}
}
}
#endregion
foreach(Control c in this.Controls)
{
if(c.Enable==true)
{
c.Enable=false;
}
}