using System;
using System.Windows.Forms;
public class UIControl
{
delegate void dg_SetControlVisible(Control c, bool v);
dg_SetControlVisible _dg_SetControlVisible;
void en_dg_SetControlVisible(Control c, bool v)
{
c.Visible = v;
}
public void dSetControlVisible(Control c, bool v)
{
c.Invoke(_dg_SetControlVisible, new object[] { c, v });
}
delegate void dg_SetControlText(Control c, string txt);
dg_SetControlText _dg_SetControlText;
int en_dg_GetControlValue(Control c)
{
int vl = 0;
switch (c.GetType().FullName)
{
case "System.Windows.Forms.TrackBar":
vl = ((System.Windows.Forms.TrackBar)c).Value;
break;
}
return vl;
}
public int dGetControlValue(Control c)
{
return int.Parse(c.Invoke(_dg_GetControlValue, new object[] { c }).ToString());
}
delegate void dg_EnableControl(Control c, bool can);
dg_EnableControl _dg_EnableControl;
void en_dg_EnableControl(Control c, bool can)
{
c.Enabled = can;
}
public void dSetControlEnable(Control c, bool can)
{
c.Invoke(_dg_EnableControl, new object[] { c, can });
}
delegate int dg_GetControlValue(Control c);
dg_GetControlValue _dg_GetControlValue;
void en_dg_SetControlText(Control c, string txt)
{
c.Text = txt;
}
public void dSetControlText(Control c, string txt)
{
c.Invoke(_dg_SetControlText, new object[] { c, txt });
}
delegate void dg_SetTxtToClipBoard(Form frm, string txt);
dg_SetTxtToClipBoard _dg_SetTxtToClipBoard;
void en_dg_SetTxtToClipBoard(Form frm, string txt)
{
Clipboard.SetText(txt);
}
public void dSetTxtToClipboard(Form frm, string txt)
{
frm.Invoke(_dg_SetTxtToClipBoard, new object[] { frm, txt });
}
public UIControl()
{
_dg_SetTxtToClipBoard = new dg_SetTxtToClipBoard(en_dg_SetTxtToClipBoard);
_dg_SetControlText = new dg_SetControlText(en_dg_SetControlText);
_dg_GetControlValue = new dg_GetControlValue(en_dg_GetControlValue);
_dg_EnableControl = new dg_EnableControl(en_dg_EnableControl);
_dg_SetControlVisible = new dg_SetControlVisible(en_dg_SetControlVisible);
}
}