我有 3 个表格;
表格 1 - 主表格
Form2 - 子表单(包含进度条和计时器)
Form3 - 包含大量内容的子表单需要时间来加载(例如从网页解析数据并在表单加载事件中将其写入 Datagridview)
我需要在加载 form3 时显示 form2 并运行进度条
我在 Form1 有以下代码;
Me.Hide
Form2.Show()
Form3.Show()
表格 2 中的代码;
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LoadingTimer.Enabled = True
End Sub
Private Sub LoadingTimer_Tick(sender As Object, e As EventArgs) Handles LoadingTimer.Tick
If MyProgressBar.Value <= MyProgressBar.Maximum - 1 Then
MyProgressBar.Value += 10
End If
If MyProgressBar.Value = 100 Then
LoadingTimer.Enabled = False
Me.Close()
End If
If Label1.ForeColor = Color.LimeGreen Then
Label1.ForeColor = Color.White
Else
Label1.ForeColor = Color.LimeGreen
End If
End Sub
End Class
问题是进度条开始但在 Form3 加载时开始冻结
有什么解决办法吗?