This project has moved and is read-only. For the latest updates, please go here.


Display control does not work in tabControl


Everything works fine until I try to place Dataweb.WinFormsUI.Display control into tabControl. It throws "System.InvalidOperationException: CurrentGraphics is not null" in v1.0.8. I tried previous versions of NShapes and it doesn't throw this exception but Display control behaves strangely and became unresponsive after some time.
Thanks for your work on this great framework!


KurtHolzinger wrote Feb 23, 2012 at 7:51 AM

Could you please send a demo showing the error to support(at)dataweb(dot)de?
I don't believe that it is the tab control that causes the issue as the NShape Designer also uses display components in tab pages of a tab control.

jary wrote Feb 24, 2012 at 11:19 PM

OK, it seem to be solved. I suppose that it was bug related to .NET framework because since my last post I have installed some .NET4 updates. Last week I have spend whole weekend with testing and when I placed display control into tab control, compiled and ran, the program was more or less unresponsive. So this problem is solved.
There is still tiny problem with tab control. When I place display control into tab control in throws System.InvalidOperationException "Current Graphics is not null". This problem can be bypassed setting any image in BackgroundImage in display control properties. I am sending a simple project as an example to support(at)dataweb(dot)de.

wrote Feb 27, 2012 at 8:50 AM

KurtHolzinger wrote Feb 27, 2012 at 8:56 AM

Thanks for your feedback and your demo project. We can reproduce the issue and we will fix it.

As workarounds, you have the following options:
a) Create the display component at runtime
b) Assign a "BackColor" with transparency to the tab page, e.g. "Control" (default value is "Transparent").
c) Assign a background image to the display

I would recommend option a) or b) unless you want a background image for your display.

wrote Mar 16, 2012 at 9:12 AM

hongzhou_zhang wrote Jul 5, 2012 at 4:08 PM

Hi, I have similar error message "current graphics is not null" when I upgrade to virtual studio 2010 from 2008. this issue was marked as fixed so I upgrade to your latest version 2.0.1 and also tried the work around you provided, however the issue continues. Any idea?


KurtHolzinger wrote Jul 6, 2012 at 12:50 PM

Sorry, I cannot reproduce the error using NShape 2.0.1.
Please check your references and make sure that "Specific Version" is set to false.
Please check also if there are NShape 1.x assemblies left in the directory of your application's exe or in the GAC.
You can also check the WinFormsUI assemblies' version by selecting the Display component in the WinForms Designer of VisualStudio and check the (readonly) property "ProcudtVersion".

If you are using NShape 2.x and still get this error, could you please provide a small demo where I can see the problem?

hongzhou_zhang wrote Jul 10, 2012 at 4:34 PM

Thanks. It works now. I must mixed both version together.

wrote Feb 21, 2013 at 11:31 PM

wrote May 16, 2013 at 11:08 AM

wrote May 16, 2013 at 11:08 AM

wrote Jun 14, 2013 at 8:21 AM