level 11
图片处理不是吧的长项
尤其动画类的,强烈建议用flash
2019年11月13日 09点11分
3
level 12
我敲得怎么不能动
代码:
Option Explicit
Dim X As Integer, Y As Integer '定义变量
Private Sub Command1_Click() '开始按钮
If X = 0 Then
X = 1: Command1.Caption = "停止"
Else
X = 0: Command1.Caption = "开始"
End If
End Sub
Private Sub Command2_Click() '退出按钮
End
End Sub
Private Sub Form_Load()
X = 0
Y = 0
End Sub
Private Sub Timer1_Timer() 'Timer事件过程
If X = 1 Then
Image2.Picture = Image1(Y).Picture: Y = Y + 1
If (Y = 2) Then
Y = 0
End If
End If
End Sub
2020年06月18日 21点06分
10
level 15
12楼的这段代码不需要在窗体上添加任何控件,连定时器控件都是用代码生成的
补充一下其中的几个变量定义:
Private WithEvents timer1 As Timer
Private bird1 As StdPicture, bird2 As StdPicture, bird3 As StdPicture
2020年06月19日 01点06分
14
谢miku_con 那是不是把您上面的代码加到前面,就好
2020年06月19日 01点06分
@zgzzsn 如果你要用那段代码的话,是这样的;那位大佬也给出了他自己的建议,你可以像原来自己做的那样用Timer和Image控件,不过只需要一个Image控件,用来显示图片
2020年06月19日 01点06分
level 12
mijing2000老师的方法我也很感兴趣,还还没有调试成功,盼望得到指点帮助,有一个完整的代码,学习学习
下面我在电脑上敲了进来,但还不通
Option Explicit
'Private WithEvents timer1 As Timer
'Private bird1 As StdPicture, bird2 As StdPicture, bird3 As StdPicture
Private Sub Form_Load()
Dim timer1 As Timer
Dim bird1 As StdPicture, bird2 As StdPicture, bird3 As StdPicture
Set timer1 = New Timer
timer1.Interval = 100
timer1.Enabled = True
Setbird1 = LoadPicture("D:\G\! zsn20180717\1 cad\2 cad\VB6\2 VB图形\1 vb画图代码\1.1 vb timer时钟\蝴蝶11.jpg")
Setbird2 = LoadPicture("D:\G\! zsn20180717\1 cad\2 cad\VB6\2 VB图形\1 vb画图代码\1.1 vb timer时钟\蝴蝶22.jpg")
Setbird3 = LoadPicture("D:\G\! zsn20180717\1 cad\2 cad\VB6\2 VB图形\1 vb画图代码\1.1 vb timer时钟\蝴蝶33.jpg")
End Sub ' Fom_Load
End Sub
Public Sub Timer()
Dim bird1 As StdPicture, bird2 As StdPicture, bird3 As StdPicture
Static flag As Integer
Select Case flag Mod 3
Case 0 '=fag Mod 3
Set Me.Picture = bird1
Case 1 '=fag Mod 3
Set Me.Picture = bird2
Case 2 '=fag Mod 3
Set Me.Picture = bird3
End Select '=fag Mod 3
flag = flag + 1
If flag = 9 Then flag = 0
End Sub
2020年06月19日 02点06分
15
谁让你改代码的……照抄都不会么
2020年06月19日 02点06分
当然,文件路径那部分除外,这个你肯定要改成自己的文件
2020年06月19日 02点06分
timer直接用控件,不用定义,不用new
2020年06月19日 03点06分