Page 1 of 1

Exception when re-showing subform with graph

Posted: Mon Dec 07, 2009 6:29 pm
by 13052841
Hi, I created a chart on a subform and then I create an object of the subform in my main form initialization. I can click a showGraph button which will execute subform.showDialogue() or subform.show(). When I am done viewing the subform, I call subform.hide(). This works great.

However, when I try to view the form again by clicking on the showGraph button from the main form, I get this error:
ArgumentException was unhandled
Parameter is not valid.


I have uploaded a Test project that will demonstrate this (DragPoint_FlatLine.zip). Simply click Show Graph, then close the new form, and click Show Graph again.

Maybe I shouldn't be coding it this way, but any ideas/suggestions?

Thanks

Re: Exception when re-showing subform with graph

Posted: Wed Dec 09, 2009 10:05 am
by narcis
Hi LibDundas,

Using Show instead of ShowDialog works fine for me, for example:

Code: Select all

        private void btnShowGraph_Click(object sender, EventArgs e)
        {
            try
            {
								//frmGraph.ShowDialog(this);
							frmGraph.Show(this);

            }
            catch (Exception ex)
            {
                int temp = 0;
                throw;
            }
        }
Can you please try if this solves the problem at your end?

Re: Exception when re-showing subform with graph

Posted: Wed Dec 09, 2009 4:42 pm
by 13052841
Narcís wrote:Hi LibDundas,
Can you please try if this solves the problem at your end?
Hi Narcís, using Show() does work. I originally chose to use ShowDialog() so the user was forced to work on the form that I popped up.

Do you think this a bug with how TeeChart responds to a ShowDialog()?

Re: Exception when re-showing subform with graph

Posted: Thu Dec 10, 2009 8:43 am
by narcis
Hi LibDundas,

I've stripped down all TeeChart code from your project and works fine either using ShowDialog or Show. I may still be missing something but I've added the issue (TF02014589) to the defect list to be investigated.

Re: Exception when re-showing subform with graph

Posted: Thu Dec 10, 2009 2:10 pm
by 13052841
Narcís wrote:I've added the issue (TF02014589) to the defect list to be investigated.
Thanks Narcís...hopefully you guys can find out exactly what's wrong.

Re: Exception when re-showing subform with graph

Posted: Mon Apr 05, 2010 5:48 pm
by 13052841
Narcís wrote:I've stripped down all TeeChart code from your project and works fine either using ShowDialog or Show.
Hi Narcís, do you know if this issue has been looked at? I also stripped down my example program but I still see the problem using the last version 4.0.

Re: Exception when re-showing subform with graph

Posted: Tue Apr 06, 2010 10:26 am
by narcis
Hi LibDundas,

No, the issue hasn't been investigated yet. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's fixed on them.

Re: Exception when re-showing subform with graph

Posted: Fri Apr 09, 2010 9:58 am
by narcis
Hi LibDundas,

We have been investigating the issue and found it is not a bug.

When using the Graphics3D.BufferStyle = OptimizedBuffer (default setting) on a modal form and you hide it and reopen it, the System.Drawing.Graphics.GetHdc, the windows handle, gets mangled. To work around this problem, simply set the buffer to null when hiding the form so forcing TeeChart to create a new one. In your code this would look like:

Code: Select all

        private void btnClose_Click(object sender, EventArgs e)
        {
					this.tChart1.Graphics3D.BackBuffer = null;
					this.Hide();
        }