我使用过这段代码:
private void bgworker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Close();
}
并以表格结束:
private void Form_FormClosing(object sender, FormClosingEventArgs e)
{
TopMost = false;
do { ++Top; Application.DoEvents(); Thread.Sleep(5); }
while (Top != r.Bottom);
}
我有这个错误: “对类型为'System.Windows.Forms!System.Windows.Forms.NativeMethods + WndProc :: Invoke'的垃圾收集委托进行了回调。这可能导致应用程序崩溃,损坏和数据丢失。将委托传递给非托管代码时,它们必须由托管应用程序保持活着,直到确保它们永远不会被调用。“