In multithreaded C # development, Value Dispose () cannot be invoked when error execution CreateHandle () is encountered. , this error comes out when the form is closed. The reason is that the form also has createhandle () events, so it is not possible to recycle garbage. The handle handle of the current form has not yet been created complete
Therefore, it is not possible to close the operation directly, and the workaround is as follows:
protected override void Onvisiblechanged (EventArgs e)
{
base. Onvisiblechanged (e);
if (! ishandlecreated)
{this
. Close ();
}
}
You can also override Onshown or write in the shown event response.
The first method is:
Since the contents of the SWF inside the outside has no effect, then he error error, in the closing add
C # code?
1 2 3 4 5 6 7 8 9 10 |
try {axshockwaveflash1.dispose (); catch (System.Exception ex) {} |
In this way, when the official version is closed, the error is try out.
The second method is:
Inside the closing, add
C # code?
1 2 |
Mythread.abort (); this. Controls.clear (); |