public void CallEventNewLevel(DoubleLevel newLevel) { if (OnNewLevel.NotIsNull()) { OnNewLevel(newLevel); } }
/// <summary> /// Рисует уровень в виде луча /// </summary> /// <param name="g"></param> /// <param name="rect"></param> /// <param name="lev"></param> /// <param name="widthLine"></param> private void PaintLineLevel(Graphics g, Rectangle rect, DoubleLevel lev, float widthLine = 1) { var horLine = new HorLine(); horLine.ColorLine = horLine.ColorText = Color.Blue; horLine.TextHAlign = HorLine.DirectionLine.Left; horLine.WidthLine = widthLine; horLine.FillText = true; horLine.Paint(g, rect, lev.Top, lev.Top.ToString(), Panel.Params.MaxPrice, Panel.Params.MinPrice); }
/// <summary> /// Рисует уровень ввиде свободного прямоугольника /// </summary> /// <param name="g"></param> /// <param name="rect"></param> /// <param name="lev"></param> /// <param name="widthLine"></param> private void PaintRectangleLevel(Graphics g, Rectangle rect, DoubleLevel lev, float widthLine = 1) { int yTop = GMath.GetCoordinate(rect.Height, Panel.Params.MaxPrice, Panel.Params.MinPrice, lev.Top); int yBot = GMath.GetCoordinate(rect.Height, Panel.Params.MaxPrice, Panel.Params.MinPrice, lev.Bottom); if (yBot < 0 && yTop > 0) { yBot = rect.Y + rect.Height; } if (yTop < 0 && yBot > 0) { yTop = rect.Y; } var height = yBot - yTop; if (height <= 0) { return; } var rectLev = new RectDraw(); rectLev.ColorBorder = Color.FromArgb(100, Color.Black); rectLev.ColorFill = Color.FromArgb(40, Color.Blue); rectLev.WidthBorder = widthLine; rectLev.Paint(g, rect.X, yTop, rect.Width, height); var middleLine = new Line(); middleLine.Width = 1; middleLine.Style = System.Drawing.Drawing2D.DashStyle.Dot; middleLine.Paint(g, new PointF(rect.X, yTop + height / 2), new PointF(rect.X + rect.Width, yTop + height / 2), Color.FromArgb(100, Color.Black)); var topText = new TextDraw(); var dataText = topText.GetSizeText(g, lev.Top.ToString()); int HeightText = (int)dataText.Height; if (height > HeightText * 3 && rect.Width > dataText.Width) { topText.Paint(g, lev.Top.ToString(), rect.X, yTop); topText.Paint(g, lev.Bottom.ToString(), rect.X, yBot - HeightText); } }