/// <summary> /// Constructor /// </summary> public DataGridViewDoubleInputColumn() { CellTemplate = new DataGridViewDoubleInputCell(); _DoubleInput = new DoubleInput(); _DoubleInput.BackgroundStyle.Class = ElementStyleClassKeys.DataGridViewNumericBorderKey; _DoubleInput.Visible = false; }
private float? GetOptionalFloat(DoubleInput textbox, CheckBoxX checkBox) { return checkBox.Checked ? (float?)textbox.Value : null; }
private void LoadOptionalFloat(float? source, DoubleInput target, CheckBoxX checkBox) { checkBox.Checked = source != null; if (source != null) target.Value = source.Value; }
/// <summary> /// DrawText /// </summary> /// <param name="di"></param> /// <param name="r"></param> /// <param name="g"></param> private void DrawText(DoubleInput 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(DoubleInput 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); } }