自动切换代码运行不管用
Dim pic1 As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim comState As WinForm.TextBox = e.Form.Controls("txtComState")
'pbx.Image = GetImage("C:\Sample.bmp")
For i As Integer =0 To 9
e.Form.StopRedraw()
'pic1.Image=GetImage(ProjectPath & "Images\btncheckon2.png") '原文件路径
pic1.ImageFile=ProjectPath & "Images\btncheckon2.png" '原文件路径
e.Form.ResumeRedraw()
Threading.Thread.Sleep(1000)
e.Form.StopRedraw()
pic1.ImageFile=ProjectPath & "Images\btncheckoff2.png" '原文件路径
'pic1.Image=GetImage(ProjectPath & "Images\btncheckoff2.png") '原文件路径
e.Form.ResumeRedraw()
Threading.Thread.Sleep(1000)
Next
手动切换代码,可以成功运行
Dim pic1 As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim comState As WinForm.TextBox = e.Form.Controls("txtComState")
If comState.text=0 Then
comState.text=1
pic1.ImageFile=ProjectPath & "Images\btncheckon2.png" '原文件路径
Else If comState.text=1 Then
comState.text=0
pic1.ImageFile=ProjectPath & "Images\btncheckoff2.png" '原文件路径
End If
[此贴子已经被作者于2023/12/27 11:17:28编辑过]