Vb.net,多线程,新线程启动后,界面响应变慢,但可以相应,怎么解决?
发布网友
发布时间:2024-10-24 04:24
我来回答
共1个回答
热心网友
时间:2024-10-31 11:31
以下是在多线程中显示进度条代码
'定义一个委托
Delegate Sub dl_ShowProgress(ByVal iValue As Integer)
Public Sub ShowProgress(ByVal iValue As Integer)
If ProgressBar1.IsDisposed Then
Return
End If
If ProgressBar1.InvokeRequired = True Then
Dim pInvoke As New dl_ShowProgress(AddressOf ShowProgress)
Me.Invoke(pInvoke, New Object() {iValue})
Else
ProgressBar1.Value = iValue
ProgressBar1.Refresh()
End If
End Sub
'在多线程中调用ShowProgress(*)函数