Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1573 - TeeChart Paint Event is Not Firing
Summary: TeeChart Paint Event is Not Firing
Status: RESOLVED NOTABUG
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Chart (show other bugs)
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-29 09:03 EDT by narcís calvet
Modified: 2016-07-05 04:35 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description narcís calvet 2016-06-29 09:03:24 EDT
We are not getting TeeChart's Paint Event on Runtime. For other controls Paint event is getting called successfully. AfterDraw event works fine instead. Code to reproduce the problem:

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      var series = new Steema.TeeChart.Styles.Points(tChart1.Chart);
      series.FillSampleValues();

      tChart1.Paint += TChart1_Paint;
      //tChart1.AfterDraw += TChart1_AfterDraw;
      tChart1.MouseMove += TChart1_MouseMove;
    }

    private void TChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      g.Pen.Color = Color.Red;
      g.Line(new Point(0, MouseLocation.Y), new Point(Width, MouseLocation.Y));
      g.Pen.Color = Color.Black;
      g.Line(new Point(MouseLocation.X, 0), new Point(MouseLocation.X, Height));
    }

    private void TChart1_MouseMove(object sender, MouseEventArgs e)
    {
      MouseLocation = e.Location;
      tChart1.Invalidate(); //or tChart1.Draw();
    }

    Point MouseLocation;

    private void TChart1_Paint(object sender, PaintEventArgs e)
    {
      e.Graphics.DrawLine(Pens.Red, new Point(0, MouseLocation.Y), new Point(Width, MouseLocation.Y));
      e.Graphics.DrawLine(Pens.Black, new Point(MouseLocation.X, 0), new Point(MouseLocation.X, Height));
    }
Comment 1 christopher ireland 2016-07-05 04:35:56 EDT
The reason the Paint event is not firing is because the TChart class overrides the OnPaint virtual method but does not make a call to base.OnPaint. The reason it does not make a call to base.OnPaint is because of the custom graphics buffering TChart uses.

If, for whatever reason, you wish to draw in the Paint method, you will have to derive a custom class from TChart and override the OnPaint method.