![]() | Steema Issues DatabaseNote: 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. |
| Summary: | TeeChart Paint Event is Not Firing | ||
|---|---|---|---|
| Product: | .NET TeeChart | Reporter: | narcís calvet <narcis> |
| Component: | Chart | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED NOTABUG | ||
| Severity: | normal | CC: | chris |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| URL: | http://www.teechart.net/support/viewtopic.php?f=4&t=16168&sid=32372b57b79c566794db24eaf294da52 | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
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. |
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)); }