protected virtual void DrawChart(ChartPaintEventArgs e) { e.Graphics.Clear(ChartBackColor); DrawLabels(e); foreach (ChartLayer layer in Layers) { layer.Draw(e); } }
protected void DrawLabels(ChartPaintEventArgs e) { foreach (ChartLabel cl in this.Labels) { if (cl != null) { DrawLable(cl, e); } } }
public void CopyTo(ChartPaintEventArgs e) { e.BackBrush = this.BackBrush; e.ForeBrush = this.ForeBrush; e.Font = this.Font; }
void ChartBox_Paint(object sender, PaintEventArgs e) { Point pt = Point.Empty; if (HorizontalScroll.Enabled) { pt.X = HorizontalScroll.Value; } if (VerticalScroll.Enabled) { pt.Y = VerticalScroll.Value; } if (Zoom != 1 && Zoom > 0) { pt.X = (int)Math.Round(pt.X / Zoom); pt.Y = (int)Math.Round(pt.Y / Zoom); } if (ChartBox.Margin.Left != 0) { pt.X -= ChartBox.Margin.Left; } if (ChartBox.Margin.Top != 0) { pt.Y -= ChartBox.Margin.Top; } if (!CustomDoubleBuffer || BmpBuffer == null) { ChartPaintEventArgs cpe; if (CustomDoubleBuffer) { BmpBuffer = new Bitmap(ChartBox.Width, ChartBox.Height); Graphics grf = Graphics.FromImage(BmpBuffer); cpe = new ChartPaintEventArgs(grf, ChartBox.ClientRectangle); } else { cpe = new ChartPaintEventArgs(e); } cpe.LogicViewPort = ChartBox.ClientRectangle; cpe.BackBrush = new SolidBrush(ChartBackColor); cpe.ForeBrush = new SolidBrush(ChartForeColor); cpe.Font = ChartBox.DefaultChartFont; if (Zoom != 1.0f) { cpe.Graphics.ScaleTransform(Zoom, Zoom); } if (HighQualityRender) { PaintHelper.SetHighQualityRender(cpe.Graphics); } if (!pt.IsEmpty) { cpe.Graphics.TranslateTransform(-pt.X, -pt.Y); Rectangle rect = cpe.LogicViewPort; rect.Offset(pt.X, pt.Y); cpe.LogicViewPort = rect; } // Draw Chart DrawChart(cpe); if (CustomDoubleBuffer) { cpe.Graphics.Dispose(); } } if (CustomDoubleBuffer && BmpBuffer != null) { e.Graphics.DrawImage(BmpBuffer, new Rectangle(0, 0, ChartBox.Width, ChartBox.Height), 0, 0, BmpBuffer.Width, BmpBuffer.Height, GraphicsUnit.Pixel); } if (CustomDoubleBuffer) { //e.Graphics.TranslateTransform(-pt.X, -pt.Y); //e.Graphics.ScaleTransform(Zoom, Zoom); PaintHelper.SetHighQualityRender(e.Graphics); } foreach (ChartLayer layer in Layers) { layer.DrawRealTime(e); } OnAfterPaint(e); }