以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]自动切换图片代码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=189806) |
-- 作者:puma -- 发布时间:2023/12/27 11:17:00 -- [求助]自动切换图片代码 自动切换代码运行不管用 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编辑过]
|
-- 作者:有点蓝 -- 发布时间:2023/12/27 11:21:00 -- 如果要实现一闪一闪的相关,放到计时器处理 |