/// <summary> /// Determines whether the active type is button. /// </summary> /// <param name="controlType">Type of the control.</param> /// <returns></returns> public static bool IsButton(enControl_InputType controlType) { var isButton = (controlType == enControl_InputType.Button1 || controlType == enControl_InputType.Button2 || controlType == enControl_InputType.Button3); return(isButton); }
/// <summary> /// Determines whether the active type is a checkbox. /// </summary> /// <returns></returns> public static bool IsRadioButton(enControl_InputType type) { var isRadioButton = (type == enControl_InputType.RadioButton2 || type == enControl_InputType.RadioButton3 || type == enControl_InputType.RadioButton4); return(isRadioButton); }
/// <summary> /// Determines whether the active type is a checkbox. /// </summary> /// <returns></returns> public static bool IsCheckbox(enControl_InputType type) { var isCheckbox = (type == enControl_InputType.Checkbox1 || type == enControl_InputType.Checkbox2 || type == enControl_InputType.Checkbox3); return(isCheckbox); }
/// <summary> /// Initializes a new instance of the <see cref="onInputControl_EventArgs" /> class. /// </summary> /// <param name="controlType">Type of the control.</param> /// <param name="value">The value.</param> /// <param name="text">The text.</param> /// <param name="value1">if set to <c>true</c> [value1].</param> /// <param name="value2">if set to <c>true</c> [value2].</param> /// <param name="value3">if set to <c>true</c> [value3].</param> public onInputControl_EventArgs(enControl_InputType controlType, object value, string text = "", bool value1 = false, bool value2 = false, bool value3 = false) { ControlType = controlType; Value = value; Text = text; // Chkbox Values Value1 = value1; Value2 = value2; Value3 = value3; }
private void Sync(enControl_InputType controlType) { if (ControlType == controlType) { switch (controlType) { case enControl_InputType.Edit_Masked: _controller.txtValueMasked.Mask = _Edit_Mask; break; case enControl_InputType.Combobox: _controller.cboValue.DropDownStyle = _DropDownStyle; break; } } }
public void Control_Type(enControl_InputType type = enControl_InputType.Edit, int rows = 1, bool actionButton = false) { #region Reset previous settings pAction_Button = actionButton; lblName.Visible = true; if (actionButton) { Control_Columns(3); } else { Control_Columns(); } if (type == enControl_InputType.Listbox) { if (rows < 3) { rows = 3; // Listbox must be at least 3 rows } } Control_Rows(rows); // Set the hight if (txtValue != null) { txtValue.Visible = false; } if (txtValueMasked != null) { txtValueMasked.Visible = false; } if (cboValue != null) { cboValue.Visible = false; } if (lstValue != null) { lstValue.Visible = false; } if (dtpValue != null) { dtpValue.Visible = false; } if (btnAction != null) { btnAction.Text = ".."; } if (btnValue1 != null) { btnValue1.Visible = false; } if (btnValue2 != null) { btnValue2.Visible = false; } if (chkValue1 != null) { chkValue1.Visible = false; } if (chkValue2 != null) { chkValue2.Visible = false; } if (chkValue3 != null) { chkValue3.Visible = false; } if (rdoValue1 != null) { rdoValue1.Visible = false; } if (rdoValue2 != null) { rdoValue2.Visible = false; } if (rdoValue3 != null) { rdoValue3.Visible = false; } if (rdoValue4 != null) { rdoValue4.Visible = false; } lblName.Text = Control_Caption; #endregion // Edit if (type == enControl_InputType.Edit) { Input_Control_Tools.Create_TextBox(pnlText, ref txtValue, Handle_OnValueChange, Handle_KeyPress); txtValue.Visible = true; if (_ControlType == enControl_InputType.Edit_Masked) { txtValue.Text = txtValueMasked.Text; } } // Edit_Masked if (type == enControl_InputType.Edit_Masked) { Input_Control_Tools.Create_TextboxMasked(pnlText, ref txtValueMasked, Handle_OnValueChange, Handle_KeyPress); txtValueMasked.Visible = true; if (_ControlType == enControl_InputType.Edit) { txtValueMasked.Text = txtValue.Text; } } // Combobox if (type == enControl_InputType.Combobox) { Input_Control_Tools.Create_Combobox(pnlText, ref cboValue, Handle_OnValueChange); cboValue.Visible = true; if (_ControlType == enControl_InputType.Listbox) { lstValue.Items.zTo_IList(cboValue.Items); //cboValue.Items.zFrom_List(lstValue.Items, true); } } // Listbox if (type == enControl_InputType.Listbox) { Input_Control_Tools.Create_Listbox(pnlText, ref lstValue, Handle_OnValueChange); lstValue.Visible = true; if (_ControlType == enControl_InputType.Combobox) { cboValue.Items.zTo_IList(lstValue.Items); //lstValue.Items.zFrom_List(cboValue.Items, true); } } // DateTime if (type == enControl_InputType.DateTime) { Input_Control_Tools.Create_DateTimePicker(pnlText, ref dtpValue, Handle_OnValueChange); dtpValue.Visible = true; } #region Button if (type == enControl_InputType.Button1 || type == enControl_InputType.Button2 || type == enControl_InputType.Button3) { Input_Control_Tools.Create_Button1(pnlLabel, ref btnValue1, Handle_Button_Click); btnValue1.Text = _Control_Caption; Control_Columns(1); //pnlLabel.Visible = pnlLabel.Dock = DockStyle.Fill; lblName.Visible = false; btnValue1.Visible = true; // Button2 if (type == enControl_InputType.Button2 || type == enControl_InputType.Button3) { Input_Control_Tools.Create_Button2(pnlText, ref btnValue2, Handle_Button_Click); btnValue2.Text = _Control_Caption2; Control_Columns(2, enControl_InputWidth.Centre); if (actionButton) { pnlButton.Visible = true; } lblName.Visible = false; btnValue2.Visible = true; } // Button3 if (type == enControl_InputType.Button3) { Control_Columns(3, enControl_InputWidth.Thirds); btnAction.Text = _Control_Caption3; pnlButton.Visible = true; lblName.Visible = false; btnAction.Visible = true; } } #endregion #region Checkbox if (type == enControl_InputType.Checkbox1 || type == enControl_InputType.Checkbox2 || type == enControl_InputType.Checkbox3) { Input_Control_Tools.Create_Checkbox(pnlLabel, ref chkValue1, _Control_Caption, Handle_OnValueChange); chkValue1.Text = _Control_Caption; chkValue1.Name = "chkValue1"; Control_Columns(1); pnlLabel.Dock = DockStyle.Fill; lblName.Visible = false; chkValue1.Visible = true; if (type == enControl_InputType.Checkbox2 || type == enControl_InputType.Checkbox3) { Input_Control_Tools.Create_Checkbox(pnlLabel, ref chkValue2, _Control_Caption2, Handle_OnValueChange); chkValue2.Text = _Control_Caption2; chkValue2.Name = "chkValue2"; chkValue2.Visible = true; } if (type == enControl_InputType.Checkbox3) { Input_Control_Tools.Create_Checkbox(pnlLabel, ref chkValue3, _Control_Caption3, Handle_OnValueChange); chkValue2.Text = _Control_Caption2; chkValue3.Text = _Control_Caption3; chkValue3.Name = "chkValue3"; chkValue3.Visible = true; } chkValue1.SendToBack(); if (chkValue3 != null) { chkValue3.BringToFront(); } if (actionButton) { pnlButton.Visible = true; } } #endregion #region RadioButton if (type == enControl_InputType.RadioButton2 || type == enControl_InputType.RadioButton3 || type == enControl_InputType.RadioButton4) { Input_Control_Tools.Create_RadioButton(pnlLabel, ref rdoValue1, _Control_Caption, Handle_OnValueChange); Input_Control_Tools.Create_RadioButton(pnlLabel, ref rdoValue2, _Control_Caption2, Handle_OnValueChange); Control_Columns(1); pnlLabel.Dock = DockStyle.Fill; lblName.Visible = false; rdoValue1.Text = _Control_Caption; rdoValue2.Text = _Control_Caption2; rdoValue1.Visible = true; rdoValue2.Visible = true; rdoValue1.Name = "rdoValue1"; rdoValue2.Name = "rdoValue2"; rdoValue1.SendToBack(); if (type == enControl_InputType.RadioButton3 || type == enControl_InputType.RadioButton4) { Input_Control_Tools.Create_RadioButton(pnlLabel, ref rdoValue3, _Control_Caption3, Handle_OnValueChange); rdoValue3.Text = _Control_Caption3; rdoValue3.Visible = true; rdoValue3.Name = "rdoValue3"; rdoValue3.BringToFront(); } if (type == enControl_InputType.RadioButton4) { Input_Control_Tools.Create_RadioButton(pnlLabel, ref rdoValue4, _Control_Caption4, Handle_OnValueChange); rdoValue4.Text = _Control_Caption4; rdoValue4.Visible = true; rdoValue4.Name = "rdoValue4"; rdoValue4.BringToFront(); } if (actionButton) { pnlButton.Visible = true; } } #endregion pnlBorder.Invalidate(); _ControlType = type; }