Vb.net,多线程,新线程启动后,界面响应变慢,但可以相应,怎么解决?
1个回答
展开全部
以下是在多线程中显示进度条代码
'定义一个委托
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(*)函数
'定义一个委托
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(*)函数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询