ArgumentException when Hiding.Showing MDI child form

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
WD_Gordon
Newbie
Newbie
Posts: 49
Joined: Wed Jun 18, 2008 12:00 am

ArgumentException when Hiding.Showing MDI child form

Post by WD_Gordon » Mon Nov 24, 2008 3:51 pm

I have read several threads on this and I am still not sure what a good approach is.

We have an MDI application that has mdi children containing charts. If the child form his hidden then shown we receive an ArgumentException when it hits the line "Chart.Graphics3D.BackBuffer.Render();" in the OnPaint of TeeChart.cs.

One solution that was pitched by Narcis was to set Graphics3D.UseBuffer to false, i.e. this.tChart1.Graphics3D.UseBuffer = false;

This certainly prevents the error but now the repainting looks bad when another window is passed over the chart. I read some other thread talking about DoubleBufferring but kind of got lost in the replies.

Is there a good solution to my problem, preventing the error and having a clean repaint?

Thanks,
Kevin

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Re: ArgumentException when Hiding.Showing MDI child form

Post by Christopher » Tue Nov 25, 2008 9:18 am

Hello,
WD_Gordon wrote:This certainly prevents the error but now the repainting looks bad when another window is passed over the chart. I read some other thread talking about DoubleBufferring but kind of got lost in the replies.

Is there a good solution to my problem, preventing the error and having a clean repaint?
The history of the implementation of manual double-buffering can be found in this thread:
http://www.teechart.net/support/viewtopic.php?t=6631

As you can read here, the primary motivation for its inclusion into TChart was to prevent sluggish repainting when one window was moved over another. However, at that stage the MDI problems hadn't come into the fore. Now that they are here, the only solution at present is to do what Narcís suggests.

We are very willing to look into this problem and find a more satisfactory solution to it. If you would be so kind as to write for us a little app we can run "as-is" to reproduce your issue, we will study it and get back to you with more options. You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

WD_Gordon
Newbie
Newbie
Posts: 49
Joined: Wed Jun 18, 2008 12:00 am

Post by WD_Gordon » Tue Nov 25, 2008 1:45 pm

Another suggestion that I saw was to set the tChart1.Chart.Graphics3D.BackBuffer to null when the object is hidden or shown, i.e. tChart1.Chart.Graphics3D.BackBuffer = null. This seems to work and paints much cleaner than setting this.tChart1.Graphics3D.UseBuffer to false.

Are there any downsides to setting the BackBuffer to null?

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Nov 25, 2008 3:17 pm

Hello,
WD_Gordon wrote:Are there any downsides to setting the BackBuffer to null?
Not at all. In fact, this is exactly what TChart's override of OnResize does:

Code: Select all

     protected override void OnResize(EventArgs e)
		{
			if (Chart.Graphics3D.BackBuffer != null)
			{
				Chart.Graphics3D.BackBuffer.Dispose();
				Chart.Graphics3D.BackBuffer = null;
			}
			base.OnResize(e);
		}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply