发布网友 发布时间:2022-04-23 16:31
共3个回答
热心网友 时间:2023-10-09 11:17
'这个拿去试一试,两个时钟,两个图片框,自己设定图片框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,让它直接画在窗体上.追问这只有两种特效,如何实现不同的特效?每显示一张图片就用一个特效显示,像POWERPOINT制作的那样,里面有好多特效,如何在vb中实现?帮忙啊!!
热心网友 时间:2023-10-09 11:17
给你提供一个思路吧:
再建一个时钟控件,用这个时钟控件控制你的特效显示,以滚动为例(不是特明白你的渐变效果,估计应该差不多)
Private Sub Timer1_Timer()
counter = counter + 1
If counter = 11 Then
counter = 1
End If
No = Trim(Str(counter))
photo.Picture = LoadPicture("\\pcmes\FQCshuju\J5机种屏保系统\tupian\" + No + ".jpg")
Timer2.Enable=True
Timer1.Enable=False
End Sub
Private Sub Timer2_Timer()
Photo.move Photo.Left+100 '图片向右移动
'在这之前你可以先定义好图片的起始位置,也可以在Timer1的事件中利用属性设置
if photo.left>form1.width then'这里是以图片移动到了窗体最右边停止时钟计算,即图片停止移动
timer2.enable=False
Timer1.Enable=True
end if
End Sub
程序未经调试,但愿这个思路对你有帮助
热心网友 时间:2023-10-09 11:18
推荐使用office2001里的PPT,里面新增了很好好看的3D特效,使用他既可做出好看的PPT 又节约了时间 并且对技术不是很好的来说 确实增色不少