Forex_Strategy_Builder.Dialogs.Generator.Top10Slot.OnPaint C# (CSharp) Метод

OnPaint() защищенный метод

Paints the chart
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
Результат void
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen penBorder = new Pen(Data.GetGradientColor(LayoutColors.ColorCaptionBack, -LayoutColors.DepthCaption), border);
            Pen penGlow = new Pen(LayoutColors.ColorWarningRowBack, 3);
            Brush brushFore = new SolidBrush(LayoutColors.ColorChartFore);

            // Paints the background by gradient
            RectangleF rectField = new RectangleF(1, 1, ClientSize.Width - 2, ClientSize.Height - 2);
            Data.GradientPaint(g, rectField, LayoutColors.ColorChartBack, LayoutColors.DepthControl);

            // Border
            g.DrawRectangle(penBorder, 1, 1, ClientSize.Width - 2, ClientSize.Height - 2);

            // Glow
            if (isSelected)
                g.DrawRectangle(penGlow, 3, 3, ClientSize.Width - 6, ClientSize.Height - 6);

            // Draws the chart image
            g.DrawImage(chart, new Point(border + space, border + space));

            // Draws the stats
            int textLeft = border + space + chart.Width + space;

            string[] paramNames = new string[] {
                Language.T("Account balance"),
                Language.T("Profit per day"),
                Language.T("Maximum drawdown"),
                Language.T("Win/loss ratio")
            };
            string[] paramValues = new string[] {
                " " + balance.ToString(),
                " " + (Configs.AccountInMoney ? profitPerDay.ToString("F2") : profitPerDay.ToString("F0")),
                " " + drawdown.ToString(),
                " " + winLoss.ToString("F2")
            };

            int maxParamNameLenght = 0;
            foreach (string parameter in paramNames)
            {
                float nameWidth = g.MeasureString(parameter, Font).Width;
                if (nameWidth > maxParamNameLenght)
                    maxParamNameLenght = (int)nameWidth;
            }
            int valLeft = textLeft + maxParamNameLenght;

            int maxParamValueLenght = 0;
            foreach (string val in paramValues)
            {
                float valWidth = g.MeasureString(val, Font).Width;
                if (valWidth > maxParamValueLenght)
                    maxParamValueLenght = (int)valWidth;
            }
            int unitLeft = valLeft + maxParamValueLenght;

            string unit = (Configs.AccountInMoney ? " " + Configs.AccountCurrency : " " + Language.T("pips")) ;
            int unitWidth = (int)g.MeasureString(unit, Font).Width;

            for (int i = 0; i < 4; i++)
            {
                int vPos = border + space + i * Font.Height;
                g.DrawString(paramNames[i], Font, brushFore, textLeft, vPos);
                g.DrawString(paramValues[i], Font, brushFore, valLeft, vPos);
                if (i < 3 && unitLeft + unitWidth < ClientSize.Width - 4)
                    g.DrawString(unit, Font, brushFore, unitLeft, vPos);
            }
            return;
        }