vb中如何使gif动起来,我不要控件,只要代码!
- 提问者网友:绫月
- 2021-04-22 06:59
- 五星知识达人网友:神的生死簿
- 2021-04-22 07:51
很简单把....
首先对控件栏点右键,部件
然后把那个Microsoft Internet Controls勾上,确定
再插入这个控件
添加以下代码:
Private Sub Form_Load()
WebBrowser1.Navigate " " '填入gif图片名称,如:1.gif,要把这图片放在与程序同一个目录下
End Sub
- 1楼网友:街头电车
- 2021-04-22 08:20
Dim flag As Boolean
Private Sub Form_Load() Timer1.Interval = 5000 Timer2.Interval = 500 Image1.Left = 0 End Sub
Private Sub Timer1_Timer() Dim i As Integer i = 1 If i = 1 Then Image1.Picture = LoadPicture("文件存储路径") i = i + 1 End If If i = 2 Then Image1.Picture = LoadPicture("文件存储路径") i = i + 1 End If End Sub
Private Sub Timer2_Timer() If Image1.Left <= 0 Then flag = False ElseIf Image1.Left >= Form1.Width - Image1.Width Then flag = True End If If flag = False Then Image1.Left = Image1.Left + 200 Else Image1.Left = Image1.Left - 200 End If End Sub