两个时钟,两个图片框,自己设定图片框2的大小,比如让它和窗体一样大
Dim Pic_num As Long
Dim Pic_name() As String
Dim pic_star As Long
Dim p_width As Single
Dim p_height As Single
Dim bili_w As Single
Dim bili_h As Single
Dim v_mod As Long
Private Sub Form_Load()
Dim L_name As String
Pic_num = 0
ReDim Pic_name(Pic_num)
L_name = Dir(App.Path & "\pic\*.JPG")
Do While L_name <> ""
ReDim Preserve Pic_name(Pic_num)
Pic_name(Pic_num) = L_name
Pic_num = Pic_num + 1
L_name = Dir
Loop
L_name = Dir(App.Path & "\pic\*.BMP")
Do While L_name <> ""
ReDim Preserve Pic_name(Pic_num)
Pic_name(Pic_num) = L_name
Pic_num = Pic_num + 1
L_name = Dir
Loop
Picture1.AutoSize = True
Picture1.AutoRedraw = True
Picture1.Visible = False
Picture2.AutoSize = False
Picture2.AutoRedraw = True
Picture2.Visible = True
Timer1.Interval = 10
Timer1.Enabled = False
Timer2.Interval = 50
Timer2.Enabled = False
If Pic_num > 0 Then
Picture1.Picture = LoadPicture(App.Path & "\pic\" & Pic_name(0))
Picture2.PaintPicture Picture1.Picture, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
Timer1.Enabled = True
Timer1.Interval = 2000
Else
MsgBox ("没有图片显示!")
End If
End Sub
Private Sub Form_Resize()
Picture2.Width = Me.Width
Picture2.Height = Me.Width
Picture2.Top = 0
Picture2.Left = 0
End Sub
Private Sub Timer1_Timer()
Dim L_id As Long
Randomize
L_id = Int((Pic_num + 1) * Rnd)
Picture1.Picture = LoadPicture(App.Path & "\pic\" & Pic_name(L_id))
bili_w = Picture1.ScaleWidth / Picture2.ScaleWidth
bili_h = Picture1.ScaleHeight / Picture2.ScaleHeight
p_width = Picture2.Width / 100
p_height = Picture2.Height / 100
pic_star = 0
Randomize
v_mod = Int(2 * Rnd)
Timer1.Enabled = False
Timer2.Enabled = True
End Sub
Private Sub Timer2_Timer()
If pic_star < 101 Then
pic_star = pic_star + 1
Select Case v_mod
Case 0
Picture2.PaintPicture Picture1.Picture, 0, 0, 100 * p_width, pic_star * p_height, 0, 0, bili_w * pic_star * p_width, bili_h * pic_star * p_height '这是第一个效果,通过修改不同的载入方式来实现不同的效果
Case 1
Picture2.PaintPicture Picture1.Picture, 0, 0, pic_star * p_width, pic_star * p_height, 0, 0, bili_w * pic_star * p_width, bili_h * pic_star * p_height '这是第二个效果,通过修改不同的载入方式来实现不同的效果
End Select
Else
pic_star = 0
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
你还可以取消图片框2,让它直接画在窗体上.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。