예제 #1
0
        public static void LoadLookup <T>(EVOComboBox control, List <T> listData, string displayMember, string valueMember)
            where T : IDataTransferObject
        {
            DataTable dt = DTOUtility.ConvertListToDataTable(listData);

            LoadLookup(control, dt, displayMember, valueMember);
        }
예제 #2
0
 public static void AssignLookup(EVOComboBox control, LookupData data)
 {
     control.DisplayMember = data.DisplayMember;
     control.ValueMember   = data.ValueMember;
     control.DataSource    = data.DataSource;
 }
예제 #3
0
 public static void LoadLookup(EVOComboBox control, DataTable listData, string displayMember, string valueMember)
 {
     control.DisplayMember = displayMember;
     control.ValueMember   = valueMember;
     control.DataSource    = listData;
 }
예제 #4
0
        private static void _EnabledControl(bool bEnabled, Control ctl)
        {
            if (ctl == null)
            {
                return;
            }
            if (ctl is TextBoxBase)
            {
                TextBoxBase txt = ((TextBoxBase)ctl);

                txt.ReadOnly = !bEnabled;
                txt.TabStop  = bEnabled;
                if (bEnabled)
                {
                    //Normal

                    txt.BackColor = Common.COLOR_NORMAL_BG;
                    txt.ForeColor = Common.COLOR_NORMAL_FG;
                }
                else
                {
                    txt.BackColor = Common.COLOR_READONLY_BG;
                    txt.ForeColor = Common.COLOR_READONLY_FG;
                }
            }
            else if (ctl is EVOComboBox)
            {
                EVOComboBox cbo = ((EVOComboBox)ctl);
                cbo.TabStop  = bEnabled;
                cbo.ReadOnly = !bEnabled;

                if (bEnabled)
                {
                    cbo.BackColor = Common.COLOR_NORMAL_BG;
                    cbo.ForeColor = Common.COLOR_NORMAL_FG;
                }
                else
                {
                    cbo.BackColor = Common.COLOR_READONLY_BG;
                    cbo.ForeColor = Common.COLOR_READONLY_FG;
                }

                cbo.SelectionStart  = 0;
                cbo.SelectionLength = 0;
            }
            else if (ctl is ComboBox)
            {
                ComboBox cbo = ((ComboBox)ctl);

                cbo.TabStop = bEnabled;
                cbo.Enabled = bEnabled;

                if (bEnabled)
                {
                    cbo.BackColor = Common.COLOR_NORMAL_BG;
                    cbo.ForeColor = Common.COLOR_NORMAL_FG;
                }
                else
                {
                    cbo.BackColor = Common.COLOR_READONLY_BG;
                    cbo.ForeColor = Common.COLOR_READONLY_FG;
                }
            }
            else if (ctl is RadioButton)
            {
                RadioButton cbo = ((RadioButton)ctl);
                cbo.TabStop = bEnabled;
                cbo.Enabled = bEnabled;
            }
            else if (ctl is DateTextBoxWithCalendar)
            {
                DateTextBoxWithCalendar dt      = (DateTextBoxWithCalendar)ctl;
                DateTextBox             textbox = null;
                Button btn = null;

                for (int i = 0; i < dt.Controls.Count; i++)
                {
                    if (dt.Controls[i] is DateTextBox)
                    {
                        textbox = (DateTextBox)dt.Controls[i];
                    }
                    if (dt.Controls[i] is Button)
                    {
                        btn = (Button)dt.Controls[i];
                    }
                }

                textbox.ReadOnly = !bEnabled;
                btn.Enabled      = bEnabled;
                dt.TabStop       = bEnabled;

                if (textbox == null)
                {
                    return;
                }

                if (bEnabled)
                {
                    textbox.BackColor = Common.COLOR_NORMAL_BG;
                    textbox.ForeColor = Common.COLOR_NORMAL_FG;
                }
                else
                {
                    textbox.BackColor = Common.COLOR_READONLY_BG;
                    textbox.ForeColor = Common.COLOR_READONLY_FG;
                }
            }
            else if (ctl is Label == false &&
                     ctl is ToolBar == false &&
                     ctl is ListView == false &&
                     ctl is Splitter == false &&
                     ctl is TreeView == false &&
                     ctl is FpSpread == false)
            {
                ctl.Enabled = bEnabled;
            }
        }