/// <summary> /// Updates the GaugeText items with the current /// cell Value /// </summary> private void UpdateText(double value) { if (EditorCell != null) { GaugeText text = GaugeItems[0] as GaugeText; if (text != null) { text.Text = value.ToString(); text.ForeColor = value > 0 ? Color.Green : Color.Crimson; } } }
private void CopyGaugeText(GaugeText gt, GaugeText clone) { if (gt != null && clone != null) gt.CopyToItem(clone); }
/// <summary> /// Initializes our gauge /// </summary> private void InitGauge() { Frame.Style = GaugeFrameStyle.None; GaugeLinearScale scale = new GaugeLinearScale(); scale.Width = .3f; scale.Size = new SizeF(.7f, .51f); scale.Location = new PointF(.6f, .5f); scale.BorderColor = Color.DimGray; scale.BorderWidth = 1; scale.MinValue = -20; scale.MaxValue = 20; scale.MinPin.Visible = false; scale.MaxPin.Visible = false; scale.Labels.Layout.Font = new Font("Arial", 10); scale.Labels.Layout.AutoSize = false; scale.MajorTickMarks.Layout.Width = .2f; scale.MajorTickMarks.Layout.Length = .2f; scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Circle; scale.MajorTickMarks.Layout.FillColor = new GradientFillColor(Color.White); scale.MajorTickMarks.Layout.FillColor.BorderColor = Color.DimGray; scale.MajorTickMarks.Layout.FillColor.BorderWidth = 1; GaugeText text = new GaugeText(); text.AutoSize = false; text.Location = new PointF(.12f, .5f); text.TextAlignment = TextAlignment.MiddleRight; GaugeItems.Add(text); LinearScales.Add(scale); GaugeSection section = new GaugeSection(scale); section.Width = .8f; section.FillColor = new GradientFillColor(Color.Red, Color.Green); scale.Sections.Add(section); GaugePointer pointer = new GaugePointer(scale); pointer.Name = "Pointer1"; pointer.Style = PointerStyle.Marker; pointer.MarkerStyle = GaugeMarkerStyle.Triangle; pointer.Placement = DisplayPlacement.Far; pointer.ScaleOffset = .03f; pointer.Width = .3f; pointer.Length = .3f; pointer.Origin = PointerOrigin.Custom; pointer.OriginInterval = 0; pointer.AllowUserChange = true; pointer.ChangeCursor = Cursors.Hand; pointer.FillColor = new GradientFillColor(Color.Yellow); pointer.FillColor.BorderColor = Color.DimGray; pointer.FillColor.BorderWidth = 1; scale.Pointers.Add(pointer); }
private void SetHThermometerDesignTimeDefaults() { _GaugeControl.Frame.Style = GaugeFrameStyle.Rectangular; SetBaseGuageColor(); GaugeLinearScale scale = new GaugeLinearScale(_GaugeControl); scale.Name = "Scale1"; scale.Width = 0.1F; scale.Location = new PointF(.55f, .51f); scale.MinValue = -30; scale.MaxValue = 40; scale.Labels.FormatString = "0°"; scale.MajorTickMarks.Layout.Placement = DisplayPlacement.Near; scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Rectangle; scale.MajorTickMarks.Layout.Width = 0.008F; scale.MinPin.Visible = false; scale.MaxPin.Visible = false; scale.MinorTickMarks.Layout.Placement = DisplayPlacement.Near; scale.MinorTickMarks.Layout.Width = 0.016F; GaugeSection section = new GaugeSection(scale); section.Name = "Section1"; section.FillColor.Color1 = Color.SteelBlue; section.FillColor.Color2 = Color.LightCyan; section.FillColor.GradientFillType = GradientFillType.HorizontalCenter; scale.Sections.Add(section); GaugePointer pointer = new GaugePointer(scale); pointer.Name = "Pointer1"; pointer.Width = 0.1F; pointer.Style = PointerStyle.Thermometer; pointer.BulbSize = 0.132F; pointer.BulbOffset = .026F; pointer.FillColor.Color1 = Color.Red; pointer.FillColor.Color2 = Color.Empty; pointer.ThermoBackColor.Color1 = Color.FromArgb(100, 60, 60, 60); pointer.Value = 12; scale.Pointers.Add(pointer); _GaugeControl.LinearScales.Add(scale); scale = new GaugeLinearScale(_GaugeControl); scale.Name = "Scale2"; scale.Width = 0.1F; scale.Location = new PointF(.55f, .51f); scale.MinValue = -22; scale.MaxValue = 104; scale.Labels.FormatString = "0°"; scale.Labels.Layout.Placement = DisplayPlacement.Far; scale.Labels.ShowMaxLabel = false; scale.Labels.ShowMinLabel = false; scale.MinPin.Visible = false; scale.MaxPin.Visible = false; scale.MajorTickMarks.Interval = 20; scale.MajorTickMarks.IntervalOffset = 2; scale.MajorTickMarks.Layout.Placement = DisplayPlacement.Far; scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Rectangle; scale.MajorTickMarks.Layout.Width = 0.008F; scale.MinorTickMarks.Interval = 4; scale.MinorTickMarks.IntervalOffset = 2; scale.MinorTickMarks.Layout.Placement = DisplayPlacement.Far; scale.MinorTickMarks.Layout.Width = 0.016F; _GaugeControl.LinearScales.Add(scale); GaugeText text = new GaugeText(_GaugeControl); text.Location = new PointF(.08f, .28f); text.Name = "Text1"; text.Text = "C°"; _GaugeControl.GaugeItems.Add(text); text = new GaugeText(_GaugeControl); text.Location = new PointF(.08f, .73f); text.Name = "Text2"; text.Text = "F°"; _GaugeControl.GaugeItems.Add(text); }