public override void Draw(Graphics Gr) { if (Gr == null) { throw new ArgumentNullException("Gr"); } LB7SegmentDisplay ctrl = this.Display; if (ctrl == null) { throw new NullReferenceException("Associated control is not valid"); } RectangleF _rc = new RectangleF(0, 0, ctrl.Width, ctrl.Height); Gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; this.DrawBackground(Gr, _rc); this.DrawOffSegments(Gr, _rc); this.DrawValue(Gr, _rc); }
/// <summary> /// Update the controls of the meter /// </summary> protected virtual void UpdateControls() { int count = this.Format.Length; this._dpPos = -1; char[] seps = new char[] { '.', ',' }; int sepIndex = this.Format.IndexOfAny(seps); if (sepIndex > 0) { count--; this._dpPos = sepIndex - 1; this._numDigits = count; } this._numDigits = count; this.Controls.Clear(); if (this.Signed != false) { LB7SegmentDisplay disp = new LB7SegmentDisplay(); disp.Name = "digit_sign"; disp.Value = -1; this.Controls.Add(disp); } for (int idx = 0; idx < count; idx++) { LB7SegmentDisplay disp = new LB7SegmentDisplay(); disp.Name = "digit_" + idx.ToString(); disp.Click += this.DisplayClicked; if (sepIndex - 1 == idx) disp.ShowDP = true; this.Controls.Add(disp); } this.RepositionControls(); }