I'm dealing with a windows forms .NET application written in C# which needs to display a 3D pdf with all the associated features (rotate the object, change lights and so on). I'm using the AxAcroPDF COM control and it run smoothly. The problem is that when I try to close the form where the control is placed, sometimes it hangs for several seconds with no apparent reason while disposing the control. The 3D file I loaded during the tests is not particulary heavy. The very same file in the standalone adobe reader opens and closes with no particular delay. I'm using the following code within the windows form closing event:
private void DrawingForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.axAcroPDF.Dispose();
Application.DoEvents();
CoFreeUnusedLibraries(); }
[System.Runtime.InteropServices.DllImport("ole32.dll")]
static extern void CoFreeUnusedLibraries();
The interesting thing is that the form closes normally if the file is just displayed, but, when the object within the 3D file is rotated, it hangs during closing. When it hangs, the icon of a watch (the same shown in standalone Adobe PDF) is displayed. The hanging time is between 15-20 seconds. I tried to display the file within the webbrowser control but I got similar results. What can be the cause of this problem? I tried to search for alternative stable controls but I haven't found any with 3D support.