Exemplo n.º 1
0
        protected override void CalcHorizontalMarkerBounds(GaugeLinearScale scale, int y)
        {
            int n = (int)(GaugePointer.BulbOffset * scale.ScaleBounds.Width);

            if (Marker < Origin)
            {
                RoundAngle = 180;

                int len = Math.Max(1, (int)((Origin - Marker) * Dpt) + n);
                int x;

                if (scale.Reversed == true)
                {
                    x = scale.ScaleBounds.Right - (int)(Origin * Dpt) - n;
                }
                else
                {
                    x = scale.ScaleBounds.X + (int)(Marker * Dpt);
                    int x2 = scale.ScaleBounds.X + (int)(Origin * Dpt) + n;

                    len = Math.Max(1, x2 - x + 1);
                }

                Bounds = new Rectangle(x, y, len, Width);

                double maxMarker = GetInterval(double.MinValue) - scale.MinValue;

                _BackBounds = Bounds;
                _BackBounds.Width = (int)((Origin - maxMarker) * Dpt + n);

                if (scale.Reversed == false)
                    _BackBounds.X = scale.ScaleBounds.Left + (int)(maxMarker * Dpt);
            }
            else
            {
                RoundAngle = 0;

                int len = Math.Max(1, (int)((Marker - Origin) * Dpt) + n);
                int x;
                
                if (scale.Reversed == true)
                    x = scale.ScaleBounds.Right - (int)(Origin * Dpt) - len + n;
                else
                    x = scale.ScaleBounds.X + (int)(Origin * Dpt) - n;

                Bounds = new Rectangle(x, y, len, Width);

                double maxMarker = GetInterval(double.MaxValue) - scale.MinValue;

                _BackBounds = Bounds;
                _BackBounds.Width = (int)((maxMarker - Origin) * Dpt + n);

                if (scale.Reversed == true)
                    _BackBounds.X = scale.ScaleBounds.Right - (int)(maxMarker * Dpt) + 1;
            }
        }
Exemplo n.º 2
0
        private void CalcVerticalLayout(GaugeLinearScale scale)
        {
            int n = scale.AbsWidth;

            _Length = (int)(n * _Layout.Length);
            _Width = (int)(n * _Layout.Width);

            if (_Layout.Length > 0 && _Length < 2)
                _Length = 2;

            if (_Layout.Width > 0 && _Width < 2)
                _Width = 2;

            int offset = (int)(n * _Layout.ScaleOffset);

            _Bounds = scale.ScaleBounds;
            _Bounds.Width = _Length;

            switch (_Layout.Placement)
            {
                case DisplayPlacement.Near:
                    _Bounds.X = scale.ScaleBounds.Left - _Length - offset;
                    break;

                case DisplayPlacement.Center:
                    _Bounds.X = scale.Center.X - _Length / 2 - offset;
                    break;

                case DisplayPlacement.Far:
                    _Bounds.X = scale.ScaleBounds.Right + offset;
                    break;
            }

            _Offset = _Bounds.X - scale.ScaleBounds.X;
        }
Exemplo n.º 3
0
 private void CalcLinearMetrics(GaugeLinearScale scale)
 {
     if (scale.Orientation == Orientation.Horizontal)
         CalcHorizontalLayout(scale);
     else
         CalcVerticalLayout(scale);
 }
Exemplo n.º 4
0
        private void CalcLinearLabelPoints(GaugeLinearScale scale)
        {
            double labelInterval = (_Interval.Equals(double.NaN) ?
                scale.MajorTickMarks.Interval : _Interval);

            double labelIntervalOffset = (_IntervalOffset.Equals(double.NaN) ?
                scale.MajorTickMarks.IntervalOffset : _IntervalOffset);

            double spread = Math.Abs(scale.MaxValue - scale.MinValue);
            double dpt = scale.AbsScaleLength / spread;

            int n = GetPointCount(spread, labelInterval, labelIntervalOffset);

            if (n > 0)
            {
                if (scale.Orientation == Orientation.Horizontal)
                    CalcHorizontalLabelPoints(scale, n, dpt, labelInterval, labelIntervalOffset);
                else
                    CalcVerticalLabelPoints(scale, n, dpt, labelInterval, labelIntervalOffset);
            }
            else
            {
                _LabelPoints = null;
            }
        }
Exemplo n.º 5
0
        private GraphicsPath GetLinearBarPath(GaugeLinearScale scale, Rectangle b)
        {
            GraphicsPath path = new GraphicsPath();

            if (GaugePointer.BarStyle == BarPointerStyle.Square)
            {
                path.AddRectangle(b);
            }
            else
            {
                return ((scale.Orientation == Orientation.Horizontal)
                            ? GetHorizontalBarPath(path, b)
                            : GetVerticalBarPath(path, b));
            }

            return (path);
        }
Exemplo n.º 6
0
        protected virtual void CalcVerticalMarkerPoint(GaugeLinearScale scale)
        {
            int offset = GaugePointer.Offset;

            int x = scale.ScaleBounds.X + scale.ScaleBounds.Width / 2 + offset;

            switch (GaugePointer.Placement)
            {
                case DisplayPlacement.Near:
                    x -= Width;
                    break;

                case DisplayPlacement.Center:
                    x -= (Width / 2);
                    break;

                case DisplayPlacement.Far:
                    break;
            }

            Dpt = scale.ScaleBounds.Height / scale.Spread;

            _Origin = GetOriginInterval() - scale.MinValue;
            _Marker = GetInterval(Value) - scale.MinValue;

            CalcVerticalMarkerBounds(scale, x);
        }
Exemplo n.º 7
0
 protected virtual void CalcLinearMarkerPoint(GaugeLinearScale scale)
 {
     if (scale.Orientation == Orientation.Horizontal)
         CalcHorizontalMarkerPoint(scale);
     else
         CalcVerticalMarkerPoint(scale);
 }
Exemplo n.º 8
0
        private string GetScaleName(GaugeLinearScale scale)
        {
            for (int i = 1; i < 100; i++)
            {
                string s = "Scale" + i.ToString();

                if (scale.GaugeControl.LinearScales[s] == null)
                    return (s);
            }

            return (null);
        }
Exemplo n.º 9
0
        private void PaintLinearRotatedLabel(Graphics g, string text,
            Brush br, LabelPoint lp, Font font, GaugeLinearScale scale)
        {
            SizeF sz = g.MeasureString(text, font);
            Size size = sz.ToSize();

            float fontAngle = Layout.Angle;

            g.TranslateTransform(lp.Point.X, lp.Point.Y);

            if (scale.Orientation == Orientation.Horizontal)
                g.TranslateTransform(0, -GetRadiusDelta(size.Width, size.Height, fontAngle));
            else
                g.TranslateTransform(-GetRadiusDelta(size.Height, size.Width, fontAngle), 0);

            g.RotateTransform(fontAngle % 360);

            g.DrawString(text, font, br,
                         new Point(-size.Width / 2, -size.Height / 2));

            g.ResetTransform();
        }
Exemplo n.º 10
0
        private int GetFarLabelOffset(GaugeLinearScale scale)
        {
            int offset = scale.AbsScaleWidth;

            if (scale.MajorTickMarks.Visible &&
                scale.MajorTickMarks.Layout.Placement == DisplayPlacement.Far)
            {
                int n = scale.MajorTickMarks.Offset + scale.MajorTickMarks.Length;

                if (n > offset)
                    offset = n;
            }

            if (scale.MinorTickMarks.Visible &&
                scale.MinorTickMarks.Layout.Placement == DisplayPlacement.Far)
            {
                int n = scale.MinorTickMarks.Offset + scale.MinorTickMarks.Length;

                if (n > offset)
                    offset = n;
            }

            return (offset);
        }
Exemplo n.º 11
0
        private int GetNearLabelOffset(GaugeLinearScale scale)
        {
            int offset = 0;

            if (scale.MajorTickMarks.Visible &&
                scale.MajorTickMarks.Layout.Placement == DisplayPlacement.Near
                && scale.MajorTickMarks.Offset < offset)
            {
                offset = scale.MajorTickMarks.Offset;
            }

            if (scale.MinorTickMarks.Visible &&
                scale.MinorTickMarks.Layout.Placement == DisplayPlacement.Near &&
                scale.MinorTickMarks.Offset < offset)
            {
                offset = scale.MinorTickMarks.Offset;
            }

            return (offset);
        }
Exemplo n.º 12
0
        private void CalcLinearMetrics(GaugeLinearScale scale)
        {
            int width = scale.AbsWidth;
            int offset = (int)(width * _Layout.ScaleOffset);

            switch (_Layout.Placement)
            {
                case DisplayPlacement.Near:
                    _Offset = GetNearLabelOffset(scale) - offset;
                    break;

                case DisplayPlacement.Center:
                    _Offset = scale.AbsScaleWidth / 2 - offset;
                    break;

                case DisplayPlacement.Far:
                    _Offset = GetFarLabelOffset(scale) + offset;
                    break;
            }
        }
Exemplo n.º 13
0
        private Font GetAbsFont(GaugeLinearScale scale)
        {
            float emSize = _Layout.Font.SizeInPoints;

            emSize = (emSize / 120) * scale.AbsWidth;

            return (new Font(_Layout.Font.FontFamily, emSize, _Layout.Font.Style));
        }
Exemplo n.º 14
0
        private double GetLvValueFromPoint(GaugeLinearScale scale, Point pt, out bool pegged)
        {
            double spread = scale.MaxValue - scale.MinValue;
            double tpd = spread / scale.ScaleBounds.Height;

            double interval = (pt.Y - scale.ScaleBounds.Y) * tpd;

            if (scale.Reversed == true)
                return (GetIntervalEx(scale.MinValue + interval, out pegged));

            return (GetIntervalEx(scale.MaxValue - interval, out pegged));
        }
Exemplo n.º 15
0
        private double GetLValueFromPoint(GaugeLinearScale scale, Point pt)
        {
            bool pegged;

            double value = (scale.Orientation == Orientation.Horizontal)
                               ? GetLhValueFromPoint(scale, pt, out pegged)
                               : GetLvValueFromPoint(scale, pt, out pegged);

            if (GaugePointer.SnapInterval > 0)
            {
                if (pegged == false)
                    value = (int)(value / GaugePointer.SnapInterval) * GaugePointer.SnapInterval;
            }

            return (value);
        }
Exemplo n.º 16
0
        private Orientation GetDefaultOrientation(GaugeLinearScale scale)
        {
            foreach (GaugeLinearScale gls in scale.GaugeControl.LinearScales)
            {
                if (gls != scale)
                    return (gls.Orientation);
            }

            return (scale.GaugeControl.Width > scale.GaugeControl.Height
                ? Orientation.Horizontal : Orientation.Vertical);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        private void CalcLinearLabelPoint(GaugeLinearScale scale)
        {
            _LabelPoint = new LabelPoint();

            if (scale.Orientation == Orientation.Horizontal)
            {
                _LabelPoint.Point = new Point(
                    _GaugePin.Bounds.X + _GaugePin.Bounds.Width / 2,
                    scale.ScaleBounds.Y + Offset);
            }
            else
            {
                _LabelPoint.Point = new Point(
                   scale.ScaleBounds.X + Offset,
                   _GaugePin.Bounds.Y + _GaugePin.Bounds.Height / 2);
            }
        }
Exemplo n.º 19
0
        private void SetVerticalDesignTimeDefaults()
        {
            _GaugeControl.Frame.Style = GaugeFrameStyle.Rectangular;

            SetBaseGuageColor();

            GaugeLinearScale scale = new GaugeLinearScale(_GaugeControl);
            scale.Name = "Scale1";
            scale.Orientation = Orientation.Vertical;

            scale.MaxValue = 50;
            scale.Labels.Layout.ScaleOffset = .03f;

            scale.MinPin.Visible = false;
            scale.MaxPin.Visible = false;

            _GaugeControl.LinearScales.Add(scale);

            GaugeSection section = new GaugeSection(scale);

            section.Name = "Section1";
            section.FillColor = new GradientFillColor(Color.CornflowerBlue, Color.Purple);

            scale.Sections.Add(section);

            GaugePointer pointer = new GaugePointer(scale);

            pointer.Name = "Pointer1";
            pointer.Style = PointerStyle.Marker;
            pointer.Placement = DisplayPlacement.Far;
            pointer.ScaleOffset = .05f;

            pointer.FillColor = new GradientFillColor(Color.Red);
            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;

            Color color1 = Color.FromArgb(100, 60, 60, 60);

            pointer.ThermoBackColor = new GradientFillColor(color1);
            pointer.ThermoBackColor.BorderColor = Color.Black;
            pointer.ThermoBackColor.BorderWidth = 1;

            scale.Pointers.Add(pointer);
        }
Exemplo n.º 20
0
        protected virtual void CalcHorizontalMarkerBounds(GaugeLinearScale scale, int y)
        {
            double origin = _Origin;
            double marker = _Marker;

            _RoundAngle = 0;

            if (marker < origin)
            {
                _RoundAngle += 180;

                SwapDoubles(ref marker, ref origin);
            }

            int len = (int)((marker - origin) * Dpt);

            int x = (scale.Reversed == true)
                ? scale.ScaleBounds.Right - (int)(origin * Dpt) - len
                : scale.ScaleBounds.X + (int)(origin * Dpt);

            _Bounds = new Rectangle(0, 0, len, Width);
            _Bounds.Location = new Point(x, y);
        }
Exemplo n.º 21
0
        private void SetV2ScalesDesignTimeDefaults()
        {
            _GaugeControl.Frame.Style = GaugeFrameStyle.Rectangular;

            SetBaseGuageColor();

            GaugeLinearScale scale = new GaugeLinearScale(_GaugeControl);
            scale.Name = "Scale1";
            scale.Orientation = Orientation.Vertical;

            scale.MaxValue = 50;
            scale.Width = 0.14F;

            scale.BorderColor = Color.Gray;
            scale.BorderWidth = 1;
            scale.Location = new PointF(.5f, .53f);

            scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Rectangle;
            scale.MajorTickMarks.Layout.Placement = DisplayPlacement.Near;
            scale.MajorTickMarks.Layout.Width = 0.047F;

            scale.MinorTickMarks.Layout.Placement = DisplayPlacement.Near;

            scale.MaxPin.Visible = false;
            scale.MinPin.Visible = false;

            GaugeSection section = new GaugeSection(scale);
            section.Name = "Section1";

            section.FillColor.Color1 = Color.CornflowerBlue;

            scale.Sections.Add(section);

            GaugePointer pointer = new GaugePointer(scale);
            pointer.Name = "Pointer1";
            pointer.Style = PointerStyle.Bar;

            pointer.CapFillColor.BorderColor = Color.DimGray;
            pointer.CapFillColor.BorderWidth = 1;
            pointer.CapFillColor.Color1 = Color.WhiteSmoke;
            pointer.CapFillColor.Color2 = Color.DimGray;

            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;
            pointer.FillColor.Color1 = Color.Red;

            pointer.Value = 15;

            scale.Pointers.Add(pointer);

            _GaugeControl.LinearScales.Add(scale);

            scale = new GaugeLinearScale(_GaugeControl);
            scale.Name = "Scale2";
            scale.Orientation = Orientation.Vertical;
            
            scale.Width = 0.14F;
            scale.MaxValue = 25;

            scale.Location = new PointF(.5f, .53f);

            scale.Labels.Layout.Placement = DisplayPlacement.Far;
            scale.Labels.Layout.ScaleOffset = 0.054F;

            scale.MajorTickMarks.Interval = 5;
            scale.MajorTickMarks.Layout.Width = 0.047F;
            scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Rectangle;
            scale.MajorTickMarks.Layout.Placement = DisplayPlacement.Far;

            scale.MinorTickMarks.Interval = 1.25f;
            scale.MinorTickMarks.Layout.Placement = DisplayPlacement.Far;

            scale.MaxPin.Visible = false;
            scale.MinPin.Visible = false;

            _GaugeControl.LinearScales.Add(scale);
        }
Exemplo n.º 22
0
        protected virtual void CalcVerticalMarkerBounds(GaugeLinearScale scale, int x)
        {
            double origin = _Origin;
            double marker = _Marker;

            _RoundAngle = -90;

            if (marker < origin)
            {
                _RoundAngle += 180;

                SwapDoubles(ref marker, ref origin);
            }

            int len = (int)((marker - origin) * Dpt);

            int y = (scale.Reversed == true)
                ? scale.ScaleBounds.Top + (int)(marker * Dpt) - len
                : scale.ScaleBounds.Bottom - (int)(marker * Dpt);

            _Bounds = new Rectangle(0, 0, Width, len);
            _Bounds.Location = new Point(x, y);
        }
Exemplo n.º 23
0
        private void SetVMultiBarsDesignTimeDefaults()
        {
            _GaugeControl.Frame.Style = GaugeFrameStyle.Rectangular;

            SetBaseGuageColor();

            GaugeLinearScale scale = new GaugeLinearScale(_GaugeControl);
            scale.Name = "Scale1";
            scale.Orientation = Orientation.Vertical;

            scale.MaxValue = 50;
            scale.Width = 0;

            scale.Labels.Layout.Placement = DisplayPlacement.Near;
            scale.Location = new PointF(.38f, .5f);

            scale.MajorTickMarks.Layout.Placement = DisplayPlacement.Near;
            scale.MajorTickMarks.Layout.Style = GaugeMarkerStyle.Rectangle;
            scale.MajorTickMarks.Layout.Width = 0.044F;

            scale.MinorTickMarks.Layout.Placement = DisplayPlacement.Near;

            scale.MaxPin.Visible = false;
            scale.MinPin.Visible = false;

            GaugePointer pointer = new GaugePointer(scale);
            pointer.Name = "Pointer1";
            pointer.Style = PointerStyle.Bar;
            pointer.BarStyle = BarPointerStyle.Rounded;

            pointer.Width = .12f;
            pointer.ScaleOffset = 0.022F;
            pointer.Placement = DisplayPlacement.Far;

            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;
            pointer.FillColor.Color1 = Color.Yellow;

            pointer.Value = 15;

            scale.Pointers.Add(pointer);

            pointer = new GaugePointer(scale);
            pointer.Name = "Pointer2";
            pointer.Style = PointerStyle.Bar;
            pointer.BarStyle = BarPointerStyle.Rounded;

            pointer.Width = .12f;
            pointer.ScaleOffset = 0.17F;
            pointer.Placement = DisplayPlacement.Far;

            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;
            pointer.FillColor.Color1 = Color.Gold;

            pointer.Value = 25;

            scale.Pointers.Add(pointer);

            pointer = new GaugePointer(scale);
            pointer.Name = "Pointer3";
            pointer.Style = PointerStyle.Bar;
            pointer.BarStyle = BarPointerStyle.Rounded;

            pointer.Width = .12f;
            pointer.ScaleOffset = 0.318F;
            pointer.Placement = DisplayPlacement.Far;

            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;
            pointer.FillColor.Color1 = Color.Chartreuse;

            pointer.Value = 35;

            scale.Pointers.Add(pointer);

            pointer = new GaugePointer(scale);
            pointer.Name = "Pointer4";
            pointer.Style = PointerStyle.Bar;
            pointer.BarStyle = BarPointerStyle.Rounded;

            pointer.Width = .12f;
            pointer.ScaleOffset = 0.46F;
            pointer.Placement = DisplayPlacement.Far;

            pointer.FillColor.BorderColor = Color.DimGray;
            pointer.FillColor.BorderWidth = 1;
            pointer.FillColor.Color1 = Color.Turquoise;

            pointer.Value = 50;

            scale.Pointers.Add(pointer);

            _GaugeControl.LinearScales.Add(scale);
        }
Exemplo n.º 24
0
 private void GetLPointerPath(GaugeLinearScale scale)
 {
     if (_Bounds.Width > 0 && _Bounds.Height > 0)
         PointerPath = GetLinearBarPath(scale, _Bounds);
 }
Exemplo n.º 25
0
            /// <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);
            }
Exemplo n.º 26
0
        private void CalcVerticalLabelPoints(GaugeLinearScale scale,
            int n, double dpt, double labelInterval, double labelIntervalOffset)
        {
            double interval = (_ShowMinLabel == true ?
                0 : labelIntervalOffset > 0 ? labelIntervalOffset : labelInterval);

            int x = scale.ScaleBounds.X + Offset;

            _LabelPoints = new LabelPoint[n];

            for (int i = 0; i < n; i++)
            {
                _LabelPoints[i] = new LabelPoint();

                if (interval + Scale.MinValue > Scale.MaxValue)
                    interval = Scale.MaxValue - Scale.MinValue;

                int y = (scale.Reversed == true)
                     ? (int)(Scale.Bounds.Top + dpt * interval)
                     : (int)(Scale.Bounds.Bottom - dpt * interval);

                _LabelPoints[i].Point = new Point(x, y);
                _LabelPoints[i].Interval = interval;

                if (interval >= labelIntervalOffset)
                    interval += labelInterval;
                else
                    interval = labelIntervalOffset;
            }
        }
Exemplo n.º 27
0
        private void CalcLinearTickPoints(
            GaugeLinearScale scale, double ticks, int n)
        {
            double dpt = scale.AbsScaleLength/ticks;

            if (scale.Orientation == Orientation.Horizontal)
                CalcHorizontalTickPoints(n, dpt);
            else
                CalcVerticalTickPoints(n, dpt);
        }
Exemplo n.º 28
0
        private void CalcHorizontalLayout(GaugeLinearScale scale)
        {
            int n = scale.AbsWidth;

            _Length = (int)(n * _Layout.Length);
            _Width = (int)(n * _Layout.Width);

            if (_Layout.Length > 0 && _Length < 2)
                _Length = 2;

            if (_Layout.Width > 0 && _Width < 2)
                _Width = 2;

            int offset = (int) (n * _Layout.ScaleOffset);

            _Bounds = scale.ScaleBounds;
            _Bounds.Height = _Length;

            switch (_Layout.Placement)
            {
                case DisplayPlacement.Near:
                    _Bounds.Y = scale.ScaleBounds.Top - _Length - offset;
                    break;

                case DisplayPlacement.Center:
                    _Bounds.Y = scale.Center.Y - _Length / 2 - offset;
                    break;

                case DisplayPlacement.Far:
                    _Bounds.Y = scale.ScaleBounds.Bottom + offset;
                    break;
            }

            _Offset = _Bounds.Y - scale.ScaleBounds.Y;
        }
Exemplo n.º 29
0
        private void CopyLinearScale(GaugeLinearScale scale)
        {
            if (_AddButton != null)
            {
                _AddButton.PerformClick();

                GaugeLinearScaleCollection lss = scale.GaugeControl.LinearScales;
                GaugeLinearScale clone = lss[lss.Count - 1];

                scale.CopyToItem(clone);
            }
        }
Exemplo n.º 30
0
 private void PaintLinearTickPoint(Graphics g,
     TickPoint tp, Image image, GaugeLinearScale scale)
 {
     if (scale.Orientation == Orientation.Horizontal)
         PaintHorizontalTickPoint(g, tp, image);
     else
         PaintVerticalTickPoint(g, tp, image);
 }
Exemplo n.º 31
0
        private void InitializeNewLinearScale(GaugeLinearScale scale)
        {
            scale.Orientation = GetDefaultOrientation(scale);

            scale.Name = GetScaleName(scale);

            GaugeSection section = new GaugeSection(scale);
            section.Name = GetSectionName(scale);

            section.FillColor = new GradientFillColor(Color.CornflowerBlue);

            scale.Sections.Add(section);
        }