I use multi custom axes to draw Fastlines and user can zoom them vertically or horizantally.
As you know when using multiple axes and doing zoom or scroll, series points can display outside the axes "zones" or limits.
To prevent this I use BeforeDrawValues and AfterDrawValues event handlers.
In Windows XP (with GDI+) it works as I expected but in Windows 7 (with Direct2D) it crashes.
I think ClipRectangle function throws exception in Direct2D mode.
You can generate exception by editing your Demo2D project.
I added the following codes in Form2.cs in demo project.
Code: Select all
//Initiliaze charts
protected override void InitializeCharts()
{
// Add following lines
fastLine.AfterDrawValues += lineSeries_AfterDrawValues;
fastLine.BeforeDrawValues += lineSeries_BeforeDrawValues;
//Add another fastline's event handler
...
tChart.Zoom.Direction = ZoomDirections.Vertical;
}
private void lineSeries_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (g.Chart.Zoom.Zoomed)
{
FastLine s = sender as FastLine;
int left = s.GetHorizAxis.IStartPos;
int right = s.GetHorizAxis.IEndPos;
int top = s.GetVertAxis.IStartPos;
int bottom = s.GetVertAxis.IEndPos;
g.ClipRectangle(left, top, right, bottom);
}
}
private void lineSeries_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.ClearClipRegions();
}
My TeeChart Version is: TeeChart for .NET 2012 4.1.2012.02280
OS is : Windows 7
Thanks for your helps...