I have created a C# ActiveX control wrapper than I am using to wrap a third party ActiveX control.
I have the ActiveX control wrapper registered and I can add it to a form in Dynamics AX. When I open the form ~400 GDI objects are created each time. However the problem I have is that when the AX form is closed, none of the GDI objects are released.
Eventually I get the following error inside AX.
I have methods that in my C# wrapper that I can call into from the Wrap I created where I am explicitly calling Dispose on the third party control. However that only cleans up around half of the GDI objects created (~200/400)
So the problem is everytime the AX form is opened and closed around ~200 new GDI objects are created.
What else can I be looking at to get rid of the rest of the GDI objects created (or nearly all of them?)