private void chartSelectRange_CustomPaint(object sender, CustomPaintEventArgs e) { if (Diagram == null) { return; } ControlCoordinates leftBottom = Diagram.DiagramToPoint(minRange, Convert.ToDouble(Diagram.AxisY.VisualRange.MinValue)); ControlCoordinates leftTop = Diagram.DiagramToPoint(minRange, Convert.ToDouble(Diagram.AxisY.VisualRange.MaxValue)); ControlCoordinates rightTop = Diagram.DiagramToPoint(maxRange, Convert.ToDouble(Diagram.AxisY.VisualRange.MaxValue)); ControlCoordinates leftZero = Diagram.DiagramToPoint(Convert.ToDateTime(Diagram.AxisX.VisualRange.MinValue), Convert.ToDouble(Diagram.AxisY.VisualRange.MaxValue)); ControlCoordinates rightMax = Diagram.DiagramToPoint(Convert.ToDateTime(Diagram.AxisX.VisualRange.MaxValue), Convert.ToDouble(Diagram.AxisY.VisualRange.MaxValue)); int width = rightTop.Point.X - leftBottom.Point.X; int height = leftBottom.Point.Y - leftTop.Point.Y; SolidBrush highlight = new SolidBrush(Color.FromArgb(128, Color.LightGoldenrodYellow)); e.Graphics.FillRectangle(highlight, leftZero.Point.X, leftZero.Point.Y, leftTop.Point.X - leftZero.Point.X - 1, height); e.Graphics.FillRectangle(highlight, leftTop.Point.X + width + 1, leftTop.Point.Y, rightMax.Point.X - rightTop.Point.X - 1, height); }
private void chartControl1_CustomPaint(object sender, CustomPaintEventArgs e) { if (ShouldZoom()) { DrawZoomBox(e); } }
private void waterfall_CustomPaint(object sender, CustomPaintEventArgs e) { CustomPaintEventHandler waterfallCustomPaint = this.WaterfallCustomPaint; if (waterfallCustomPaint != null) { waterfallCustomPaint(sender, e); } }
private void spectrumAnalyzer_BackgroundCustomPaint(object sender, CustomPaintEventArgs e) { CustomPaintEventHandler spectrumAnalyzerBackgroundCustomPaint = this.SpectrumAnalyzerBackgroundCustomPaint; if (spectrumAnalyzerBackgroundCustomPaint != null) { spectrumAnalyzerBackgroundCustomPaint(sender, e); } }
private void DrawZoomBox(CustomPaintEventArgs e) { int minX = Math.Min(FirstPoint.Value.X, SecondPoint.Value.X); int minY = Math.Min(FirstPoint.Value.Y, SecondPoint.Value.Y); int maxX = Math.Max(FirstPoint.Value.X, SecondPoint.Value.X); int maxY = Math.Max(FirstPoint.Value.Y, SecondPoint.Value.Y); e.Graphics.DrawRectangle(Pens.Black, minX, minY, maxX - minX, maxY - minY); }
private void chart_CustomPaint(object sender, CustomPaintEventArgs e) { Graphics g = e.Graphics; g.SetClip(CalculateDiagramBounds()); g.SmoothingMode = SmoothingMode.AntiAlias; if (!_selectionRectangle.IsEmpty) { g.FillRectangle(new SolidBrush(SelectionRectColor), _selectionRectangle); g.DrawRectangle(new Pen(SelectionRectBorderColor), _selectionRectangle); } }
// to draw the rectangle for the Zoom without Shift public void OnCustomPaint(object sender, CustomPaintEventArgs e) { if (_selectionRectangle.IsEmpty) { return; } Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; g.FillRectangle(new SolidBrush(_selectionRectColor), _selectionRectangle); g.DrawRectangle(new Pen(_selectionRectBorderColor), _selectionRectangle); }
void chartControl1_CustomPaint(object sender, CustomPaintEventArgs e) { DiagramCoordinates coords = Diagram.PointToDiagram(new Point(x, y)); if (coords.IsEmpty || chart.Series[0].Points.Count == 0) { return; } SeriesPoint nearestPoint = chart.Series[0].Points[0]; foreach (SeriesPoint point in chart.Series[0].Points) { if (point.NumericalArgument == coords.NumericalArgument) { nearestPoint = point; break; } else if (Math.Abs(nearestPoint.NumericalArgument - coords.NumericalArgument) > Math.Abs(point.NumericalArgument - coords.NumericalArgument)) { nearestPoint = point; } } ControlCoordinates pointCoords = Diagram.DiagramToPoint(nearestPoint.NumericalArgument, nearestPoint.Values[0]); ControlCoordinates leftBottom = Diagram.DiagramToPoint(AxisXRange.MinValueInternal, AxisYRange.MinValueInternal); ControlCoordinates rightTop = Diagram.DiagramToPoint(AxisXRange.MaxValueInternal, AxisYRange.MaxValueInternal); e.Graphics.DrawLine(Pens.Black, new Point(leftBottom.Point.X, pointCoords.Point.Y), new Point(rightTop.Point.X, pointCoords.Point.Y)); e.Graphics.DrawLine(Pens.Black, new Point(pointCoords.Point.X, rightTop.Point.Y), new Point(pointCoords.Point.X, leftBottom.Point.Y)); Rectangle markerRect = new Rectangle(pointCoords.Point.X - markerSize, pointCoords.Point.Y - markerSize, 2 * markerSize, 2 * markerSize); e.Graphics.FillEllipse(Brushes.Red, markerRect); e.Graphics.DrawEllipse(Pens.Black, markerRect); string text = "(" + nearestPoint.NumericalArgument.ToString() + ", " + nearestPoint.Values[0].ToString() + ")"; SizeF textSize = e.Graphics.MeasureString(text, Font); Rectangle rect = new Rectangle(pointCoords.Point.X + markerSize, pointCoords.Point.Y + markerSize, (int)Math.Ceiling(textSize.Width), (int)Math.Ceiling(textSize.Height)); e.Graphics.FillRectangle(Brushes.White, rect); e.Graphics.DrawRectangle(Pens.Black, rect); e.Graphics.DrawString(text, Font, Brushes.Black, rect); }
private void chartControl1_CustomPaint(object sender, CustomPaintEventArgs e) { ChartControl chart = (ChartControl)sender; Series series = chart.Series[0]; Point[] screenPoints = new Point[series.Points.Count]; for (int i = 0; i < series.Points.Count; i++) { screenPoints[i] = ((XYDiagram2D)chart.Diagram).DiagramToPoint(series.Points[i].Argument, series.Points[i].Values[0]).Point; } Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; g.FillPolygon(new SolidBrush(Color.LightGreen), screenPoints); g.DrawPolygon(new Pen(Color.DarkGreen, 2), screenPoints); }
private void chart_CustomPaint(object sender, CustomPaintEventArgs e) { // e.Graphics.DrawRectangle(Pens.White, 0, 0, 20, 20); }
void IChartEventsProvider.OnCustomPaint(CustomPaintEventArgs e) { }
private void ChartControl_CustomPaint(object sender, CustomPaintEventArgs e) { return; }