CmdPause是一个pictureBox,载入图像作为暂停、继续的图像按钮,在点击时先作判断来决定载入的图像,即如果当时是“暂停”图像,点击后被“继续”图像代替,与之相反。
我作如下处理,无效,肯定是不能这样判断,但实在毫无办法,请指教,谢谢
Private Sub CmdPause_Click()
If CmdPause.Picture = LoadPicture(App.Path +"\images\pause.gif"then'暂停
Timer1.Enabled = False
CmdPause.Picture = LoadPicture(App.Path + "\images\go.gif") '继续
Picture1.Enabled = False
Else
Timer1.Enabled = True
CmdPause.Picture = LoadPicture(App.Path + "\images\pause.gif '暂停
Picture1.Enabled = True
Text1(TextIndex).SetFocus
End If
End Sub
我作如下处理,无效,肯定是不能这样判断,但实在毫无办法,请指教,谢谢
Private Sub CmdPause_Click()
If CmdPause.Picture = LoadPicture(App.Path +"\images\pause.gif"then'暂停
Timer1.Enabled = False
CmdPause.Picture = LoadPicture(App.Path + "\images\go.gif") '继续
Picture1.Enabled = False
Else
Timer1.Enabled = True
CmdPause.Picture = LoadPicture(App.Path + "\images\pause.gif '暂停
Picture1.Enabled = True
Text1(TextIndex).SetFocus
End If
End Sub
Private Sub CmdPause_Click()
If CmdPause.Picture = LoadPicture(App.Path +"\images\pause.gif") then'暂停
Timer1.Enabled = False
CmdPause.Picture = LoadPicture(App.Path + "\images\go.gif") '继续
Picture1.Enabled = False
Else
Timer1.Enabled = True
CmdPause.Picture = LoadPicture(App.Path + "\images\pause.gif") '暂停
Picture1.Enabled = True
Text1(TextIndex).SetFocus
End If
End Sub
不是理论上比变量慢,实际上就是比变量慢(访问属性要寻址,变量是直接在内存中,肯定慢了),不过如果是单条语句的话没什么影响,如果是在循环中,则一定要用变量~~