/// <summary> /// Рендеринг графиков /// </summary> /// <param name="dc">контекст рисования</param> protected void Render(DrawingContext dc) { Rect graphicRect = new Rect(this.Field.Location, new Size(this.Field.Width, HeightGraphic)); for (int i = 0; i < CommonData.RenderedGraphics.Count; i++) { dc.PushOpacity(0.5); dc.DrawRoundedRectangle( Macros.ChooseBrush(i, new LinearGradientBrush( new GradientStopCollection() { new GradientStop(Colors.LightSteelBlue, 0.5), new GradientStop(Colors.LightSlateGray, 1) }, new Point(0, 0), new Point(0, 1)), CommonData.IndexActiveGraphic, new LinearGradientBrush( new GradientStopCollection() { new GradientStop(Colors.LightSlateGray, 0.5), new GradientStop(Colors.LightYellow, 1) }, new Point(0, 0), new Point(0, 1))), null, new Rect(new Point(graphicRect.X, graphicRect.Y - 4), new Size(graphicRect.Width, graphicRect.Height + 8)), 5, 5); ToolFunctions.DrawAutoTxt(dc, CommonData.SourceGraphics[i].Name, new Rect(new Point(graphicRect.X - CommonData.Width_LeftBorder, graphicRect.Y), new Size(CommonData.Width_LeftBorder, (HeightGraphic < HeightBetweenGraphics) ? HeightBetweenGraphics : HeightGraphic)), Macros.ChooseBrush(i, Brushes.Black, CommonData.IndexActiveGraphic, Brushes.DarkBlue), TextAlignment.Center, 1.95, "Cambria"); dc.Pop(); DrawGraphic(dc, CommonData.RenderedGraphics[i], Macros.ChooseBrush(i, Brushes.Blue, CommonData.IndexActiveGraphic, Brushes.DarkBlue), graphicRect); graphicRect.Y += (HeightBetweenGraphics + HeightGraphic); } }
/*________________________________________*/ /// <summary> /// Рендеринг меток, точек пересечений и значений в них /// </summary> /// <param name="dc">Контекст рисования</param> protected void Render(DrawingContext dc) { dc.PushOpacity(0.7); /*Отрисовка меток*/ for (int i = Marks.Count - 1; i >= 0; i--) { if (Macros.CheckEntryTime(CommonData.LeftTime, Marks[i].Time, CommonData.RightTime)) { Point MarkPoint = new Point(this.Field.X + ToolFunctions.GetDxByTime(Marks[i].Time, CommonData.TimeInPoint, CommonData.LeftTime), this.Field.Y); dc.DrawLine(new Pen(Macros.ChooseBrush(i, Brushes.DarkGreen, IndexTimeMark, Brushes.Orange), 1), MarkPoint, new Point(MarkPoint.X, this.Field.Bottom)); Rect valueRect = new Rect(new Point(MarkPoint.X + 2, MarkPoint.Y + 2), new Size(6 * 5, 26)); dc.DrawRoundedRectangle( Macros.ChooseBrush(i, new LinearGradientBrush(Colors.DarkGreen, Colors.LightGreen, 0.5), IndexTimeMark, new LinearGradientBrush(Colors.Orange, Colors.OrangeRed, 0.5)), new Pen(Macros.ChooseBrush(i, Brushes.DarkGreen, IndexTimeMark, Brushes.OrangeRed), 1), valueRect, valueRect.Height / 5, valueRect.Height / 5); ToolFunctions.DrawAutoTxt(dc, Macros.TimeSpanToString(Marks[i].Time), valueRect, Brushes.White, TextAlignment.Justify, 1.95); } } /*Отрисовка значений в точке пересечения линии метки и графика*/ for (int i = CrossPoints.Count - 1; i >= 0; i--) { dc.DrawGeometry(Brushes.Brown, new Pen(Brushes.Brown, 1), new EllipseGeometry(CrossPoints[i], 1, 1)); Rect valueRect = new Rect(new Point(CrossPoints[i].X + 2, CrossPoints[i].Y + 2), new Size(Values[i].ToString().Length * 5 + 10, 13)); dc.DrawRoundedRectangle(Brushes.WhiteSmoke, new Pen(Brushes.White, 1), valueRect, valueRect.Height / 5, valueRect.Height / 5); ToolFunctions.DrawAutoTxt(dc, "0x" + Values[i].ToString("X"), valueRect, Brushes.Brown, TextAlignment.Center, 1.95); } dc.Pop(); }