?? form1.frm
字號(hào):
VERSION 5.00
Begin VB.Form Form1
Caption = "圖像動(dòng)畫(huà)"
ClientHeight = 4620
ClientLeft = 165
ClientTop = 735
ClientWidth = 6450
LinkTopic = "Form1"
ScaleHeight = 4620
ScaleWidth = 6450
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox List1
Height = 3840
ItemData = "Form1.frx":0000
Left = 3840
List = "Form1.frx":0002
TabIndex = 2
Top = 0
Width = 2055
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 1
Interval = 200
Left = 600
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 4
Interval = 200
Left = 2040
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 6
Interval = 200
Left = 3000
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 7
Interval = 200
Left = 3480
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 3
Interval = 200
Left = 1560
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 5
Interval = 200
Left = 2520
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 2
Interval = 200
Left = 1080
Top = 3480
End
Begin VB.Timer Timer
Enabled = 0 'False
Index = 0
Interval = 200
Left = 240
Top = 3480
End
Begin VB.PictureBox Picture2
AutoRedraw = -1 'True
Height = 4095
Left = 240
ScaleHeight = 4035
ScaleWidth = 3435
TabIndex = 1
Top = 240
Width = 3495
End
Begin VB.PictureBox Picture1
Height = 4095
Left = 0
ScaleHeight = 4035
ScaleWidth = 3555
TabIndex = 0
Top = 0
Width = 3615
End
Begin VB.Menu Effect
Caption = "特效"
Begin VB.Menu PushPull
Caption = "推拉"
Index = 0
Shortcut = ^P
End
Begin VB.Menu mosaic
Caption = "馬賽克"
Index = 1
Shortcut = ^M
End
Begin VB.Menu Roll1
Caption = "左滾動(dòng)"
Index = 2
Shortcut = ^R
End
Begin VB.Menu FCTA
Caption = "從中央向四周"
Index = 3
End
Begin VB.Menu FATC
Caption = "從四周向中央"
Index = 4
End
Begin VB.Menu cross
Caption = "交叉"
Index = 6
End
Begin VB.Menu VWinblind
Caption = "縱向百葉窗"
Index = 5
End
Begin VB.Menu Grid
Caption = "網(wǎng)格"
Index = 7
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim w, h As Single
'w和h分別記錄圖片的寬度和高度
Dim x, y As Single
'x和y分別為取圖位置的X坐標(biāo)和Y坐標(biāo)
'或者也可以說(shuō)成是所取區(qū)域的寬度和高度
Dim b As Boolean
Sub Stopped()
'設(shè)置各計(jì)時(shí)器無(wú)效
For i = 0 To 7
Timer(i).Enabled = False
Next
End Sub
Private Sub Reset()
w = Picture1.Width
h = Picture1.Height
'保存圖片的寬度和高度
Picture2.Width = w
Picture2.Height = h
'根據(jù)圖片設(shè)置Picture2的寬度和高度
List1.Top = 0
List1.Left = Picture2.Left + Picture2.Width + 350
'重新設(shè)置List1控件的位置
Me.Width = w + List1.Width + 700
'設(shè)置窗口的寬度
Me.Height = h + 700
'設(shè)置窗口的高度
'注意留出菜單的高度
b = False
Stopped
End Sub
Private Sub PushPull_Click(Index As Integer)
x = w / 2
y = h / 2
Timer(0).Enabled = True
'啟動(dòng)實(shí)現(xiàn)推拉效果的計(jì)時(shí)器
End Sub
Private Sub mosaic_Click(Index As Integer)
Timer(1).Enabled = True
'啟動(dòng)實(shí)現(xiàn)馬賽克效果的計(jì)時(shí)器
End Sub
Private Sub Roll1_Click(Index As Integer)
x = 0
Timer(2).Enabled = True
'啟動(dòng)實(shí)現(xiàn)左滾動(dòng)效果的計(jì)時(shí)器
End Sub
Private Sub FCTA_Click(Index As Integer)
x = 0
y = 0
Timer(3).Enabled = True
'啟動(dòng)實(shí)現(xiàn)中央向四周效果的計(jì)時(shí)器
End Sub
Private Sub FATC_Click(Index As Integer)
x = 0
y = 0
Timer(4).Enabled = True
'啟動(dòng)實(shí)現(xiàn)四周向中央效果的計(jì)時(shí)器
End Sub
Private Sub cross_Click(Index As Integer)
x = 0
y = 0
Timer(5).Enabled = True
'啟動(dòng)實(shí)現(xiàn)交叉效果的計(jì)時(shí)器
End Sub
Private Sub VWinblind_Click(Index As Integer)
x = 0
Timer(6).Enabled = True
'啟動(dòng)實(shí)現(xiàn)縱向百葉窗效果的計(jì)時(shí)器
End Sub
Private Sub Grid_Click(Index As Integer)
x = 0
y = 0
Timer(7).Enabled = True
'啟動(dòng)實(shí)現(xiàn)網(wǎng)格效果的計(jì)時(shí)器
End Sub
Private Sub Form_Load()
List1.AddItem "1.bmp", 0
List1.AddItem "2.bmp", 1
List1.AddItem "3.bmp", 2
List1.AddItem "4.bmp", 3
List1.AddItem "5.bmp", 4
List1.AddItem "6.bmp", 5
List1.AddItem "7.bmp", 6
List1.AddItem "8.bmp", 7
'添加列表項(xiàng)
Picture1.Left = 0
Picture1.Top = 0
'使Picture1位于窗口的左上角
Picture1.AutoSize = True
'使Picture1能夠根據(jù)圖片自動(dòng)更改自己的寬度和高度
Picture1.Visible = False
'隱藏Picture1
Picture1.Picture = LoadPicture(App.Path + "\1.bmp")
'在Picture1中顯示一幅圖片
Picture2.Left = 0
Picture2.Top = 0
Reset
End Sub
Private Sub List1_Click()
Picture1.Picture = LoadPicture(App.Path + "\" + List1.List(List1.ListIndex))
Reset
'選擇圖片
End Sub
Private Sub Timer_Timer(Index As Integer)
Dim m, n, xx, yy As Single
Dim i, j As Integer
Select Case Index
Case 0
'推拉效果
If b Then
x = x + w / 100
y = y + h / 100
If x >= w / 2 Or y >= h / 2 Then
b = Not b
x = w / 2 - 10
y = h / 2 - 10
End If
Else
x = x - w / 100
y = y - h / 100
If x < 0 Or y < 0 Then
b = Not b
x = 0
y = 0
End If
End If
Picture2.PaintPicture Picture1.Picture, 0, 0, w, h, x, y, w - 2 * x, h - 2 * y
Case 1
'馬賽克效果
Static c As Integer
c = c + 1
If c > 100 Then
Picture2.PaintPicture Picture1.Picture, 0, 0
c = 0
Stopped
End If
m = w / 100
n = h / 100
For i = 0 To 50 + c * 10
xx = Rnd * (w - m - 50)
yy = Rnd * (h - n - 50)
Picture2.PaintPicture Picture1.Picture, xx, yy, , , xx, yy, m, n
Next
Case 2
'左滾動(dòng)
x = x + w / 100
Picture2.PaintPicture Picture1.Picture, w - x, 0, , , 0, 0, x, h
If x >= w Then
Stopped
Picture2.Picture = Picture1.Picture
End If
Case 3
'從中央向四周
x = x + w / 100
y = y + h / 100
If x > w / 2 Or y > h / 2 Then
Stopped
Picture2.Picture = Picture1.Picture
End If
Picture2.PaintPicture Picture1.Picture, w / 2 - x, h / 2 - y, , , w / 2 - x, h / 2 - y, 2 * x, 2 * y
Case 4
'從四周向中央
x = x + w / 50
y = y + h / 50
If x > w / 2 Or y > h / 2 Then
Stopped
Picture2.Picture = Picture1.Picture
End If
Picture2.PaintPicture Picture1.Picture, 0, 0, , , 0, 0, x, y
Picture2.PaintPicture Picture1.Picture, 0, (h - y), , , 0, (h - y), x, y
Picture2.PaintPicture Picture1.Picture, (w - x), 0, , , (w - x), 0, x, y
Picture2.PaintPicture Picture1.Picture, w - x, (h - y), , , (w - x), (h - y), x, y
Case 5
'交叉
x = x + (w / 50)
If x > w Then
Stopped
Picture2.Picture = Picture1.Picture
End If
Picture2.PaintPicture Picture1.Picture, w - x, 0, , , 0, 0, x, h / 4
Picture2.PaintPicture Picture1.Picture, 0, h / 4, , , w - x, h / 4, x, h / 4
Picture2.PaintPicture Picture1.Picture, w - x, h / 2, , , 0, h / 2, x, h / 4
Picture2.PaintPicture Picture1.Picture, 0, 3 * h / 4, , , w - x, 3 * h / 4, x, h / 4
Case 6
'縱向百葉窗
m = w / 20
x = x + w / 200
If x > m Then
Stopped
Picture2.Picture = Picture1.Picture
End If
For i = 0 To 20
Picture2.PaintPicture Picture1.Picture, i * m, 0, , , i * m, 0, x, h
Next
Case 7
'網(wǎng)格效果
m = w / 20
n = h / 20
x = x + w / 200
y = y + h / 200
If x > m Then
Stopped
Picture2.Picture = Picture1.Picture
End If
For i = 0 To 20
For j = 0 To 20
Picture2.PaintPicture Picture1.Picture, i * m, j * n, , , i * m, j * n, x, y
Next j, i
End Select
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -