Page 1 of 1

Bug using TeeChart .NET v3 in dialog

Posted: Wed Jan 12, 2011 4:36 pm
by 13045423
Dear all,

When using the latest release of TeeChart .NET v3 (build 3.5.3700.30575) and Visual Studio 2008 (9.0.30729.1 SP), I get an exception when opening a dialog with a chart on it for the second time. First time it opens okay, second time an ArgumentException is thrown ({"Parameter is not valid."}), by the looks of the stack-trace because teechart is using an invalid pointer to a graphics context. The last 4 lines of the trace say:
at System.Drawing.Graphics.GetHdc()
at System.Drawing.BufferedGraphics.Render(Graphics target)
at System.Drawing.BufferedGraphics.Render()
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
In the attachment I have an example solution, with the chart on dialog1. Fix the reference to TeeChart, compile and just open it 2 times: the second time it will crash!

Yours,

André Hendriks
Deltares

Re: Bug using TeeChart .NET v3 in dialog

Posted: Thu Jan 13, 2011 10:12 am
by 10050769
Hello André,
I think you have a problem with buffer, for this reason appears ArgumentsException({"Parameter is not valid."}). I can reproduce your problem and I suggest you a solution. You only have to change the tChart1.Graphics3D.BufferStyle for DoubleBuffer or None in the close button of your Dialog1 as do in below lines of code:

Code: Select all

private void buttonClose_Click(object sender, EventArgs e
        {
            tChart1.Graphics3D.BufferStyle = Steema.TeeChart.Drawing.BufferStyle.DoubleBuffer//.None;
            this.Close();
        }
Could you tell us if previous code works as you want? If you have some problems, please let me know.

I hope will helps.

Thanks,

Re: Bug using TeeChart .NET v3 in dialog

Posted: Fri Jan 14, 2011 8:26 am
by 13045423
Dear Sandra,

Works like a breeze, both in my example and in the real code. Thank you so much!

André

Re: Bug using TeeChart .NET v3 in dialog

Posted: Fri Jan 14, 2011 10:00 am
by 10050769
Hello André,

I am glad that solution works fine for you :).

Thanks,