Exception when re-showing subform with graph

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Exception when re-showing subform with graph

Post by LibDundas » Mon Dec 07, 2009 6:29 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Exception when re-showing subform with graph

Post by Narcís » Wed Dec 09, 2009 10:05 am

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?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Exception when re-showing subform with graph

Post by LibDundas » Wed Dec 09, 2009 4:42 pm

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()?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Exception when re-showing subform with graph

Post by Narcís » Thu Dec 10, 2009 8:43 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Exception when re-showing subform with graph

Post by LibDundas » Thu Dec 10, 2009 2:10 pm

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.

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Exception when re-showing subform with graph

Post by LibDundas » Mon Apr 05, 2010 5:48 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Exception when re-showing subform with graph

Post by Narcís » Tue Apr 06, 2010 10:26 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Exception when re-showing subform with graph

Post by Narcís » Fri Apr 09, 2010 9:58 am

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();
        }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply