/// <summary> /// Constructor /// </summary> public DataGridViewIntegerInputColumn() { CellTemplate = new DataGridViewIntegerInputCell(); _IngegerInput = new IntegerInput(); _IngegerInput.BackgroundStyle.Class = ElementStyleClassKeys.DataGridViewNumericBorderKey; _IngegerInput.Visible = false; }
private void CreateValue(List<Node> re) { var value = new Node(); value.Text = "Value"; valueInput = new IntegerInput(); valueInput.Value = Value; valueInput.ValueChanged += IntegerInput_ValueChanged; value.Nodes.Add(CreateControl("Value", "Value", valueInput)); value.Expanded = true; re.Add(value); }
private int? GetOptionalInt(IntegerInput textbox, CheckBoxX checkBox) { return checkBox.Checked ? (int?)textbox.Value : null; }
private void LoadOptionalInt(int? source, IntegerInput target, CheckBoxX checkBox) { checkBox.Checked = source != null; if (source != null) target.Value = source.Value; }
public void HienThi(DataGridViewX dGV, BindingNavigator bN, TextBoxX txtMaLop, TextBoxX txtTenLop, ComboBoxEx cmbKhoiLop, ComboBoxEx cmbNamHoc, IntegerInput iniSiSo, ComboBoxEx cmbGiaoVien) { BindingSource bS = new BindingSource(); bS.DataSource = m_LopData.LayDsLop(); bN.BindingSource = bS; dGV.DataSource = bS; txtMaLop.DataBindings.Clear(); txtMaLop.DataBindings.Add("Text", bS, "MaLop"); txtTenLop.DataBindings.Clear(); txtTenLop.DataBindings.Add("Text", bS, "TenLop"); cmbKhoiLop.DataBindings.Clear(); cmbKhoiLop.DataBindings.Add("SelectedValue", bS, "MaKhoiLop"); cmbNamHoc.DataBindings.Clear(); cmbNamHoc.DataBindings.Add("SelectedValue", bS, "MaNamHoc"); iniSiSo.DataBindings.Clear(); iniSiSo.DataBindings.Add("Text", bS, "SiSo"); cmbGiaoVien.DataBindings.Clear(); cmbGiaoVien.DataBindings.Add("SelectedValue", bS, "MaGiaoVien"); }
private int? GetOptionalInt(CheckBoxX cbx, IntegerInput box) { if (cbx.Checked) return box.Value; else return null; }
private void LoadOptionalInt(int? value, CheckBoxX cbx, IntegerInput box) { if (value == null) cbx.Checked = false; else { cbx.Checked = true; box.Value = (int)value; } }
/// <summary> /// DrawText /// </summary> /// <param name="di"></param> /// <param name="r"></param> /// <param name="g"></param> private void DrawText(IntegerInput di, Rectangle r, Graphics g) { r.Inflate(-2, 0); eTextFormat tf = eTextFormat.VerticalCenter; switch (di.InputHorizontalAlignment) { case eHorizontalAlignment.Center: tf |= eTextFormat.HorizontalCenter; break; case eHorizontalAlignment.Right: tf |= eTextFormat.Right; break; } TextDrawing.DrawString(g, di.Text, di.Font, di.ForeColor, r, tf); }
/// <summary> /// DrawControl /// </summary> /// <param name="di"></param> /// <param name="r"></param> /// <param name="g"></param> private void DrawControl(IntegerInput di, Rectangle r, Graphics g) { GraphicsState gs = g.Save(); try { g.TranslateTransform(r.X, r.Y); di.Width = r.Width; di.InternalPaint(new PaintEventArgs(g, Rectangle.Empty)); } finally { g.Restore(gs); } }
private int? GetOptionalInt(CheckBoxX enabler, IntegerInput input) { return enabler.Checked ? (int?)input.Value : null; }
private void SetOptionalInt(int? value, CheckBoxX enabler, IntegerInput input) { if (value == null) enabler.Checked = false; else { enabler.Checked = true; input.Value = (int)value; } }