public DateTimeValueType() { m_control = new DateTextBoxWithCalendar(); m_control.BackColor = System.Drawing.SystemColors.Control; m_control.Format = "dd/MM/yyyy"; //m_control.dtpStartDate.Name = "dtpStartDate"; m_control.Value = new System.DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, System.DateTime.Today.Day, 0, 0, 0, 0); }
public DateTimeValueType(DateTime dtDefaultDate) { m_control = new DateTextBoxWithCalendar(); m_control.BackColor = System.Drawing.SystemColors.Control; m_control.Format = "dd/MM/yyyy"; //m_control.dtpStartDate.Name = "dtpStartDate"; m_control.Value = dtDefaultDate; }
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; } }