/// <summary> /// 往容器里添加一个复选框 /// </summary> /// <param name="kvp"></param> public void AddItem(KeyValuePair <string, object> kvp) { if (_kvList == null) { _kvList = new List <KeyValuePair <string, object> >(); } if (_kvList.Count(a => a.Value.ToString() == kvp.Value.ToString()) == 0) { _kvList.Add(kvp); } CheckBoxX cbx = new CheckBoxX(); cbx.BackgroundStyle.Class = ""; cbx.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; cbx.Style = eDotNetBarStyle.StyleManagerControlled; cbx.AutoSize = true; cbx.Text = kvp.Key; cbx.Tag = kvp.Value; flpCheckBox.Controls.Add(cbx); //增加事件 cbx.CheckedChanged += delegate(object sender, EventArgs e) { if (this.ItemCheckedChanged != null) { CheckBoxX cb = sender as CheckBoxX; this.ItemCheckedChanged(this, new CheckBoxGroupValueChangedArgs(cb.Checked, cb.Text, cb.Tag)); } }; }
private void AddCheckBox([Required] string label, [Required] string name) { var control = new CheckBoxX() { Name = name, Text = label, Dock = DockStyle.Fill, Checked = !_hiddenProperties.Contains(name) }; control.CheckedChangedEx += CheckBoxStatusChanged; _table.Controls.Add(control, 1, _rowCount); _table.SetColumnSpan(control, 2); if (_table.RowStyles.Count > _rowCount) { _table.RowStyles[_rowCount] = new RowStyle(SizeType.Absolute, 39F); } else { _table.RowStyles.Add(new RowStyle(SizeType.Absolute, 39F)); } _rowCount++; }
public void login(CheckBoxX ckb_ghinho, TextBoxX txt_id, TextBoxX txt_password, Form login, Form main) { if (string.IsNullOrEmpty(txt_id.Text.Trim())) { MessageBox.Show("Không được bỏ trống ID" + txt_id.Text.ToLower(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_id.Focus(); return; } if (string.IsNullOrEmpty(txt_password.Text)) { MessageBox.Show("Không được bỏ trống PassWord" + txt_password.Text.ToLower(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_password.Focus(); return; } if (DAO_QL_NguoiDung.Instances.Check_Config() == 0) { ProcessLogin(ckb_ghinho, txt_id, txt_password, login, main);// Cấu hình phù hợp xử lý đăng nhập } if (DAO_QL_NguoiDung.Instances.Check_Config() == 1) { MessageBox.Show("Chuỗi cấu hình không tồn tại");// Xử lý cấu hình } if (DAO_QL_NguoiDung.Instances.Check_Config() == 2) { MessageBox.Show("Chuỗi cấu hình không phù hợp");// Xử lý cấu hình } }
public void ProcessLogin(CheckBoxX ckb_ghinho, TextBoxX txt_id, TextBoxX txt_password, Form login, Form main) { string result; result = DAO_QL_NguoiDung.Instances.Check_User(txt_id.Text, txt_password.Text); if (result == "Invalid") { MessageBox.Show("Sai tài khoảng đăng nhập hoặc password", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (result == "Disabled") { MessageBox.Show("tài khoản bị khóa"); return; } if (ckb_ghinho.Checked == true) { bientoancuc.pass = txt_password.Text; bientoancuc.trangthai = true; } else { bientoancuc.trangthai = false; } //bientoancuc.manhanvien = nhan_Vien1TableAdapter.GetNhanVienTheoTenDN(txt_id.Text).Rows[0][0].ToString(); bientoancuc.tendn = txt_id.Text; login.Hide(); main.ShowDialog(); }
private void LoadOptionalFloat(float?source, DoubleInput target, CheckBoxX checkBox) { checkBox.Checked = source != null; if (source != null) { target.Value = source.Value; } }
private void LoadOptionalString(string source, TextBoxX target, CheckBoxX checkBox) { checkBox.Checked = source != null; if (source != null) { target.Text = source; } }
private void LoadOptionalInt(int?source, IntegerInput target, CheckBoxX checkBox) { checkBox.Checked = source != null; if (source != null) { target.Value = source.Value; } }
private void enablingCheckBoxCheckChanged(object sender, EventArgs e) { CheckBoxX cbx = (CheckBoxX)sender; // if (cbx.Tag is Control) ((Control)cbx.Tag).Enabled = cbx.Checked; // else foreach (Control ctrl in (Control[])cbx.Tag) // ctrl.Enabled = cbx.Checked; }
public static CheckBoxX genCheckBox(bool bChecked, Object oTag, EventHandler oCheckedChangedCallback) { var oCheckBox = new CheckBoxX(); oCheckBox.Checked = bChecked; oCheckBox.Tag = oTag; oCheckBox.CheckedChanged += oCheckedChangedCallback; return(oCheckBox); }
// Get selected learning algorithm from user private void checkBoxXTabCreateModel_CheckedChanged(object sender, EventArgs e) { CheckBoxX checkedRadioButton = sender as CheckBoxX; // Ensure that the RadioButton.Checked property changed to true. if (checkedRadioButton.Checked) { Enum.TryParse <LearningAlgorithm>(checkedRadioButton.Tag as string, out this.activeLearningAlgorithm); } }
private void LoadOptionalStr(string value, CheckBoxX cbx, TextBoxX box) { if (value == null) { cbx.Checked = false; } else { cbx.Checked = true; box.Text = value; } }
private void LoadOptionalInt(int?value, CheckBoxX cbx, IntegerInput box) { if (value == null) { cbx.Checked = false; } else { cbx.Checked = true; box.Value = (int)value; } }
private string GetOptionalStr(CheckBoxX cbx, TextBoxX box) { if (cbx.Checked) { return(box.Text); } else { return(null); } }
private int?GetOptionalInt(CheckBoxX cbx, IntegerInput box) { if (cbx.Checked) { return(box.Value); } else { return(null); } }
private void SetOptionalInt(int?value, CheckBoxX enabler, IntegerInput input) { if (value == null) { enabler.Checked = false; } else { enabler.Checked = true; input.Value = (int)value; } }
void check_Click(object sender, EventArgs e) { CheckBoxX cb = (CheckBoxX)sender; if (!(UsersHelp.systemAdimin || (UsersHelp.ParentDic.Count > 0 ? UsersHelp.ParentDic[cb.Text.Trim()] : false))) { MessageBox.Show("您没有此权限,所以您也不能赋予其他账号此权限!"); cb.AutoCheck = false; return; } }
void check3_Click(object sender, EventArgs e) { CheckBoxX cb = (CheckBoxX)sender; if (!(UsersHelp.systemAdimin || UsersHelp.AddUser)) { MessageBox.Show("您没有此权限,所以您也不能赋予其他账号此权限!"); cb.AutoCheck = false; return; } }
public void HienThi(DataGridViewX dGV, BindingNavigator bN, TextBoxX txtMaLoaiTietKiem, TextBoxX txtTenLoaiTietKiem, TextBoxX txtKyHan, TextBoxX txtDangHuyDong, CheckBoxX cbHuyDong, ComboBoxEx cmbLoaiTien, ComboBoxEx cmbKyTinhLai, ComboBoxEx cmbSoHieuTaiKhoan) { BindingSource bS = new BindingSource(); bS.DataSource = m_LoaiTietKiemData.LayLoaiTietKiem(); DataTable dT = m_LoaiTietKiemData.LayLoaiTietKiem(); bool loaitietkiem = Convert.ToBoolean(dT.Rows[0]["DangHuyDong"]); if (loaitietkiem) { cbHuyDong.Checked = true; } else { cbHuyDong.Checked = true; } txtMaLoaiTietKiem.DataBindings.Clear(); txtMaLoaiTietKiem.DataBindings.Add("Text", bS, "MaLoaiTietKiem"); txtTenLoaiTietKiem.DataBindings.Clear(); txtTenLoaiTietKiem.DataBindings.Add("Text", bS, "TenLoaiTietKiem"); txtKyHan.DataBindings.Clear(); txtKyHan.DataBindings.Add("Text", bS, "KyHan"); txtDangHuyDong.DataBindings.Clear(); txtDangHuyDong.DataBindings.Add("Text", bS, "DangHuyDong"); cmbLoaiTien.DataBindings.Clear(); cmbLoaiTien.DataBindings.Add("SelectedValue", bS, "MaLoaiTien"); cmbKyTinhLai.DataBindings.Clear(); cmbKyTinhLai.DataBindings.Add("SelectedValue", bS, "MaKyTinhLai"); cmbSoHieuTaiKhoan.DataBindings.Clear(); cmbSoHieuTaiKhoan.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoan"); bN.BindingSource = bS; dGV.DataSource = bS; }
public void RowToControl(ListView list, TextBox ma, TextBox ten, TextBox Sl, CheckBoxX phgNam, ComboBox day, ComboBox trangthai) { if (list.SelectedItems.Count > 0) { PhongInfo phong = (PhongInfo)list.SelectedItems[0].Tag; ma.Text = phong.MaPhong; ten.Text = phong.TenPhong; Sl.Text = phong.SoLuongToiDa.ToString(); phgNam.Checked = phong.PhongNam; day.Text = phong.Day.TenDay; trangthai.Text = phong.TrangThai.TenTrangThai; } }
/// <summary> /// 选择化验指标 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void assayTarget_CheckedChanged(object sender, EventArgs e) { CheckBoxX check = (CheckBoxX)sender; if (check.Checked && !this.assayTarget.Contains(check.Text)) { this.assayTarget += check.Text + ","; } else { this.assayTarget = this.assayTarget.Replace(check.Text + ",", ""); } }
/// <summary> /// Set default or not by checking checkboxes in defualtCheckBoxes array /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void defaultCheckBox_CheckedChanged(object sender, EventArgs e) { int rowCount = defaultCheckBoxes.Length / 2; CheckBoxX checkBox = (CheckBoxX)sender; for (int i = 0; i < rowCount; i++) { if (checkBox == defaultCheckBoxes[i, 0]) { defaultCheckBoxes[i, 1].Enabled = !checkBox.Checked; break; } } }
public static void SetCheckbox(CheckBoxX checkBox, bool value) { if (checkBox.InvokeRequired) { Action <CheckBoxX, bool> setCheckboxAction = SetCheckbox; //DSetListbox dSetListbox = SetListbox; checkBox.BeginInvoke(setCheckboxAction, new object[] { checkBox, value }); } else { checkBox.Checked = value; //listBox.SelectedIndex = listBox.FindString(textValue); } }
private void All_checkBoxX_CheckedChanged(object sender, EventArgs e) { CheckBoxX ck = sender as CheckBoxX; if (ck.Checked) { for (int i = 0; i < Analog_flowpanel.Controls.Count; i++) { ListViewEx analog_listview = Analog_flowpanel.Controls[i] as ListViewEx; for (int j = 0; j < analog_listview.Items.Count; j++) { analog_listview.Items[j].Checked = true; } } for (int m = 0; m < Digital_flowpanel.Controls.Count; m++) { ListViewEx digit_listview = Digital_flowpanel.Controls[m] as ListViewEx; for (int n = 0; n < digit_listview.Items.Count; n++) { digit_listview.Items[n].Checked = true; } } } else { //自身主动触发 和外部被动触发 if (trigger_flag) { trigger_flag = false; return; } for (int i = 0; i < Analog_flowpanel.Controls.Count; i++) { ListViewEx analog_listview = Analog_flowpanel.Controls[i] as ListViewEx; for (int j = 0; j < analog_listview.Items.Count; j++) { analog_listview.Items[j].Checked = false; } } for (int i = 0; i < Digital_flowpanel.Controls.Count; i++) { ListViewEx digit_listview = Digital_flowpanel.Controls[i] as ListViewEx; for (int j = 0; j < digit_listview.Items.Count; j++) { digit_listview.Items[j].Checked = false; } } } }
public void HienThi(DataGridViewX dGV, BindingNavigator bN, TextBoxX txtMaHocSinh, TextBoxX txtTenHocSinh, TextBoxX txtGioiTinh, CheckBoxX ckbGTinhNam, CheckBoxX ckbGTinhNu, DateTimeInput dtpNgaySinh, TextBoxX txtEmail, TextBoxX txtDiaChi) { BindingSource bS = new BindingSource(); bS.DataSource = m_HocSinhData.LayDsHocSinh(); DataTable dT = m_HocSinhData.LayDsHocSinh(); bool gioiTinh = Convert.ToBoolean(dT.Rows[0]["GioiTinh"]); if (gioiTinh) { ckbGTinhNu.Checked = true; } else { ckbGTinhNam.Checked = true; } txtMaHocSinh.DataBindings.Clear(); txtMaHocSinh.DataBindings.Add("Text", bS, "MaHocSinh"); txtTenHocSinh.DataBindings.Clear(); txtTenHocSinh.DataBindings.Add("Text", bS, "HoTen"); txtGioiTinh.DataBindings.Clear(); txtGioiTinh.DataBindings.Add("Text", bS, "GioiTinh"); dtpNgaySinh.DataBindings.Clear(); dtpNgaySinh.DataBindings.Add("Value", bS, "NgaySinh"); txtEmail.DataBindings.Clear(); txtEmail.DataBindings.Add("Text", bS, "Email"); txtDiaChi.DataBindings.Clear(); txtDiaChi.DataBindings.Add("Text", bS, "DiaChi"); bN.BindingSource = bS; dGV.DataSource = bS; }
private void Modifyright_buttonX_Click(object sender, EventArgs e) { try { bool[] bool_array = new bool[8]; for (int i = 0; i < checked_control.Length; i++) { CheckBoxX ck = checked_control[i] as CheckBoxX; bool_array[i] = ck.Checked; } int right_value = Convert.ToInt32(ByteTransferHelper.BitToByte(bool_array)); sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set gageright='{1}' where gageuser='******'", Constant.gage_user_sqlname, right_value, user_comboBoxEx.Text), null); MessageBox.Show("修改完成!"); } catch (Exception ex) { MessageBox.Show("修改用户权限时发生异常:" + ex.Message); } }
private void user_comboBoxEx_SelectedIndexChanged(object sender, EventArgs e) { try { DataTable userright_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select gageright from {0} where gageuser='******'", Constant.gage_user_sqlname, user_comboBoxEx.Text), null); int right_value = Convert.ToInt32(userright_dt.Rows[0][0]); byte[] byte_array = ByteTransferHelper.IntToByte(right_value); bool[] bool_array = ByteTransferHelper.ByteToBit(byte_array[0]); for (int i = 0; i < checked_control.Length; i++) { CheckBoxX ck = checked_control[i] as CheckBoxX; ck.Checked = bool_array[i]; } } catch (Exception ex) { MessageBox.Show("combox索引发生变化时发生异常:" + ex.Message); } }
public void HienThi(IntegerInput txtSiSoCanDuoi, IntegerInput txtSiSoCanTren, IntegerInput txtDoTuoiCanDuoi, IntegerInput txtDoTuoiCanTren, CheckBoxX ckbThang10, CheckBoxX ckbThang100, TextBoxX txtTenTruong, TextBoxX txtDiaChiTruong) { BindingSource bS = new BindingSource(); bS.DataSource = m_QuyDinhData.LayDsQuyDinh(); DataTable dT = m_QuyDinhData.LayDsQuyDinh(); int thangDiem = Convert.ToInt32(dT.Rows[0]["ThangDiem"]); if (thangDiem == 10) { ckbThang10.Checked = true; } else { ckbThang100.Checked = true; } txtSiSoCanDuoi.DataBindings.Clear(); txtSiSoCanDuoi.DataBindings.Add("Value", bS, "SiSoCanDuoi"); txtSiSoCanTren.DataBindings.Clear(); txtSiSoCanTren.DataBindings.Add("Value", bS, "SiSoCanTren"); txtDoTuoiCanDuoi.DataBindings.Clear(); txtDoTuoiCanDuoi.DataBindings.Add("Value", bS, "TuoiCanDuoi"); txtDoTuoiCanTren.DataBindings.Clear(); txtDoTuoiCanTren.DataBindings.Add("Value", bS, "TuoiCanTren"); txtTenTruong.DataBindings.Clear(); txtTenTruong.DataBindings.Add("Text", bS, "TenTruong"); txtDiaChiTruong.DataBindings.Clear(); txtDiaChiTruong.DataBindings.Add("Text", bS, "DiaChiTruong"); }
private List <CheckBoxX> CreateResourceSelectionBoxes() { List <CheckBoxX> addedCheckboxes = new List <CheckBoxX>(); int startX = 12; const int startY = 12; const int height = 25; const int distance = 10; const int width = 100; const int checkboxSize = 20; foreach (Resource resource in _resources) { CheckBoxX checkBox = CreateResourceSelectionBox(startX, startY, width, height, checkboxSize, resource); addedCheckboxes.Add(checkBox); startX += width + distance; } return(addedCheckboxes); }
private void checkBoxX1_CheckedChanged(object sender, EventArgs e) { ucSingleDrawImageWnd c = DrawHandle as ucSingleDrawImageWnd; if (c == null) { return; } CheckBoxX barCheckItem = sender as CheckBoxX; if (!barCheckItem.Checked) { c.DriveWays[Convert.ToInt32(barCheckItem.Tag) - 11] = false; } else { c.SetDrawType((DrawGraphType)barCheckItem.Tag); c.DriveWays[Convert.ToInt32(barCheckItem.Tag) - 11] = true; } }
private CheckBoxX CreateResourceSelectionBox(int x, int y, int width, int height, int checkboxSize, Resource item) { CheckBoxX resourceCheckbox = new CheckBoxX(); resourceCheckbox.Name = item.Code + "CheckBox"; resourceCheckbox.Text = item.Description; resourceCheckbox.Checked = true; resourceCheckbox.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; resourceCheckbox.Location = new System.Drawing.Point(x, y); resourceCheckbox.Size = new System.Drawing.Size(width, height); resourceCheckbox.CheckSignSize = new System.Drawing.Size(checkboxSize, checkboxSize); resourceCheckbox.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; resourceCheckbox.TabIndex = 3; resourceCheckbox.Font = new System.Drawing.Font("Tahoma", 12F); resourceCheckbox.Translate = false; resourceCheckbox.CheckValueChanged += ResourceCheckBox_CheckChanged; OrdersSettingsGroupBox.Controls.Add(resourceCheckbox); return(resourceCheckbox); }