示例#1
0
        /// <summary>Отрисовка перекрестья</summary>
        /// <param name="coord"></param>
        void PaintCrossLines(Point coord, Candles.DataCandle candle)
        {
            if (candle.IsNull())
            {
                return;
            }
            string d    = candle.Candle.Time.Day.ToString();
            string m    = candle.Candle.Time.Month.ToString();
            string y    = candle.Candle.Time.Year.ToString();
            string min  = candle.Candle.Time.Minute.ToString();
            string hour = candle.Candle.Time.Hour.ToString();
            string time = (d.Length < 2 ? '0' + d : d) + "." + (m.Length < 2 ? '0' + m : m) + "." + y + " " +
                          (hour.Length < 2 ? '0' + hour : hour) + ":" + (min.Length < 2 ? '0' + min : min) + " (" + candle.Description + ")";
            //GraphicShape.PaintLine(this.Canvas, new Point(coord.X, 0), new Point(coord.X, 1000), Color.Black);
            decimal priceY = GraphicShape.GetValueFromCoordinate(this.RectAllTop.Height, this.MaxPrice, this.MinPrice, coord.Y, this.PanelPrices.CountFloat);

            GraphicShape.PaintVLine(this.Canvas, this.RectAllTop, time, new Point(coord.X, 0), new Point(coord.X, this.RectAllTop.Height), Color.Black);
            GraphicShape.PaintHLine(this.Canvas, this.RectAllTop, priceY, this.MaxPrice, this.MinPrice, Color.Black);
        }
示例#2
0
 /// <summary> Инициализируем внутренние события </summary>
 private void InitEvents()
 {
     //Перед отриосвкой свечей
     PanelCandels.OnBeforePaintCandle += (emptyCandle) =>
     {
         this.ActiveCandle = null;
     };
     //Отрисовка одной свечи
     PanelCandels.OnPaintCandle += (candle) =>
     {
         if (candle.Body.X <= this.CrossLine.X && candle.Body.X + candle.Body.Width >= this.CrossLine.X)
         {
             this.ActiveCandle = candle;
         }
         if (candle.Index == this.CountCandleShowHVol)
         {
             Point p1 = new Point()
             {
                 X = candle.Body.X, Y = candle.PaintRect.Y
             };
             Point p2 = new Point()
             {
                 X = candle.Body.X, Y = candle.PaintRect.Y + candle.PaintRect.Height
             };
             GraphicShape.PaintVLine(this.Canvas, candle.PaintRect, candle.Index.ToString(), p1, p2, Color.Blue, 2);
         }
     };
     //Отрисовка свечей завершена
     PanelCandels.OnPaintedCandles += () =>
     {
         if (!this.ActiveCandle.IsNull())
         {
             this.PaintHorVolByCandle(this.Canvas, ActiveCandle, this.CrossLine);
             this.PanelCandels.MoveVerticalActiveCandle(this.ActiveCandle);
         }
         this.PaintCrossLines(this.CrossLine, ActiveCandle);
     };
 }