/// <summary>
 /// Initializes a new instance of the <see cref="MetroTrackerPath"/> class.
 /// </summary>
 public MetroTrackerPath()
 {
     MetroTrackerPath.__ENCAddToList(this);
     this._AlertAbove   = 100;
     this._AlertUnder   = 0;
     this._performAlers = false;
     this._IsOverValue  = false;
     this._IsUnderValue = false;
     this._DrawingStyle = DashStyle.Solid;
     this._DashOffset   = 2f;
     this.values        = new Queue <int>();
     this.maxStored     = 100;
     this._maximum      = 100;
     this._lineWidth    = 1f;
     this._isFilled     = false;
 }
Beispiel #2
0
        /// <summary>
        /// Handles the PropertyChanged event of the Path control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
        private void Path_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            MetroTrackerPath solidBrush   = (MetroTrackerPath)sender;
            string           propertyName = e.PropertyName;

            if (Operators.CompareString(propertyName, "LineColor", false) == 0)
            {
                this._nameBrushes[solidBrush].Dispose();
                this._nameBrushes[solidBrush] = new SolidBrush(solidBrush.LineColor);
                this._pens[solidBrush].Dispose();
                this._pens[solidBrush] = new Pen(solidBrush.LineColor, solidBrush.LineWidth);
            }
            else if (Operators.CompareString(propertyName, "LineWidth", false) == 0)
            {
                this._pens[solidBrush].Dispose();
                this._pens[solidBrush] = new Pen(solidBrush.LineColor, solidBrush.LineWidth);
            }
            else if (Operators.CompareString(propertyName, "FillColor", false) == 0)
            {
                this._brushes[solidBrush].Dispose();
                this._brushes[solidBrush] = new SolidBrush(solidBrush.FillColor);
            }
            this.Invalidate();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MetroTrackerPathCollectionEventArgs"/> class.
 /// </summary>
 /// <param name="item">The item.</param>
 public MetroTrackerPathCollectionEventArgs(MetroTrackerPath item)
 {
     this._item = item;
 }
Beispiel #4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            StringFormat stringFormat;
            Graphics     graphics = e.Graphics;
            float        width    = (float)((double)this.Width / (double)(checked (this._ShowedValueCount - 1)));

            using (Pen pen = new Pen(this._GridColor))
            {
                switch (this._GridStyle)
                {
                case Design.GridStyle.Horizontal:
                {
                    int num = checked ((int)Math.Round((double)this.Height / (double)this._GridSize));
                    for (int i = 1; i <= num; i = checked (i + 1))
                    {
                        graphics.DrawLine(pen, 0, checked (i * this._GridSize), this.Width, checked (i * this._GridSize));
                    }
                    break;
                }

                case Design.GridStyle.Vertical:
                {
                    int num1 = checked ((int)Math.Round((double)this.Width / (double)this._GridSize));
                    for (int j = 1; j <= num1; j = checked (j + 1))
                    {
                        graphics.DrawLine(pen, checked (j * this._GridSize), 0, checked (j * this._GridSize), this.Height);
                    }
                    break;
                }

                case Design.GridStyle.Crossed:
                {
                    int num2 = checked ((int)Math.Round((double)this.Height / (double)this._GridSize));
                    for (int k = 1; k <= num2; k = checked (k + 1))
                    {
                        graphics.DrawLine(pen, 0, checked (k * this._GridSize), this.Width, checked (k * this._GridSize));
                    }
                    int num3 = checked ((int)Math.Round((double)this.Width / (double)this._GridSize));
                    for (int l = 1; l <= num3; l = checked (l + 1))
                    {
                        graphics.DrawLine(pen, checked (l * this._GridSize), 0, checked (l * this._GridSize), this.Height);
                    }
                    break;
                }
                }
            }
            int count = checked (this.Paths.Count - 1);

            for (int m = 0; m <= count; m = checked (m + 1))
            {
                MetroTrackerPath item   = this.Paths[m];
                PointF[]         pointF = new PointF[checked (checked (this._ShowedValueCount - 1) + 1)];
                using (IEnumerator <int> enumerator = item.GetEnumerator())
                {
                    if (item.Count > this._ShowedValueCount)
                    {
                        int count1 = checked (checked (item.Count - this._ShowedValueCount) - 1);
                        for (int n = 0; n <= count1; n = checked (n + 1))
                        {
                            enumerator.MoveNext();
                        }
                    }
                    int num4 = checked (this._ShowedValueCount - 1);
                    for (int o = 0; o <= num4; o = checked (o + 1))
                    {
                        float single = (float)o * width;
                        if (o < checked (this._ShowedValueCount - item.Count))
                        {
                            pointF[o] = new PointF(single, (float)this.Height);
                        }
                        else
                        {
                            enumerator.MoveNext();
                            float height = (float)this.Height - (float)((double)enumerator.Current / (double)item.Maximum) * (float)this.Height;
                            pointF[o] = new PointF(single, height);
                        }
                    }
                }
                graphics.SmoothingMode     = SmoothingMode.AntiAlias;
                graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;
                graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                GraphicsPath graphicsPath = new GraphicsPath();
                graphicsPath.StartFigure();
                graphicsPath.AddLines(pointF);
                Point point = new Point(this.Width, this.Height);
                graphicsPath.AddLine(point, new Point(0, this.Height));
                graphicsPath.CloseFigure();
                if (item.IsFilled)
                {
                    graphics.FillPath(this._brushes[item], graphicsPath);
                }
                this._pens[item].DashStyle  = item.DrawingStyle;
                this._pens[item].DashOffset = item.DashOffset;
                this._pens[item].DashCap    = DashCap.Round;
                graphics.DrawPath(this._pens[item], graphicsPath);
                graphicsPath.Dispose();
            }
            graphics.SmoothingMode   = SmoothingMode.HighSpeed;
            graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
            if (this._ShowPathNames)
            {
                int num5   = Math.Max((checked (this.Height / 2 - 10)) / 18, 1);
                int num6   = 10;
                int x      = 0;
                int count2 = checked (this.Paths.Count - 1);
                for (int p = 0; p <= count2; p = checked (p + 1))
                {
                    if (p % num5 == 0)
                    {
                        num6 = checked (x + 10);
                    }
                    MetroTrackerPath metroTrackerPaths = this.Paths[p];
                    Rectangle        rectangle         = new Rectangle(num6, checked (10 + checked (p % num5 * 18)), 10, 10);
                    graphics.FillRectangle(this._nameBrushes[metroTrackerPaths], rectangle);
                    graphics.DrawRectangle(Pens.Black, rectangle);
                    Rectangle rectangle1 = new Rectangle(checked (checked (rectangle.X + rectangle.Width) + 5), checked (rectangle.Y - 3), checked (this.Width - 25), 18);
                    using (SolidBrush solidBrush = new SolidBrush(this.ForeColor))
                    {
                        stringFormat = new StringFormat()
                        {
                            Alignment     = StringAlignment.Near,
                            LineAlignment = StringAlignment.Center
                        };
                        using (StringFormat stringFormat1 = stringFormat)
                        {
                            graphics.DrawString(metroTrackerPaths.Name, this.Font, solidBrush, rectangle1, stringFormat1);
                        }
                    }
                    SizeF sizeF  = graphics.MeasureString(metroTrackerPaths.Name, this.Font);
                    float width1 = sizeF.Width;
                    if ((float)rectangle1.X + width1 > (float)x)
                    {
                        x = checked (rectangle1.X + checked ((int)Math.Round((double)width1)));
                    }
                }
            }
            if (this._ShowCustomValue)
            {
                SizeF     sizeF1     = graphics.MeasureString(this.Text, this.Font);
                Rectangle rectangle2 = new Rectangle(checked ((int)Math.Round((double)((float)((float)(checked (this.Width - 10)) - sizeF1.Width)))), 10, checked ((int)Math.Round((double)((float)(sizeF1.Width + 5f)))), checked ((int)Math.Round((double)sizeF1.Height)));
                stringFormat = new StringFormat()
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center
                };
                using (StringFormat stringFormat2 = stringFormat)
                {
                    using (SolidBrush solidBrush1 = new SolidBrush(this.ForeColor))
                    {
                        graphics.DrawString(this.Text, this.Font, solidBrush1, rectangle2, stringFormat2);
                    }
                }
            }
            using (Pen pen1 = new Pen(this._BorderColor))
            {
                Rectangle rectangle3 = new Rectangle(0, 0, checked (this.Width - 1), checked (this.Height - 1));
                graphics.DrawRectangle(pen1, rectangle3);
            }
            base.OnPaint(e);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TrackerPathAlertEventArgs"/> class.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="value">The value.</param>
 public TrackerPathAlertEventArgs(MetroTrackerPath item, int value)
 {
     this._item  = item;
     this._value = value;
 }