📄 动画_“蝴蝶飞舞”续集f.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "动画_透明处理"
ClientHeight = 4410
ClientLeft = 60
ClientTop = 345
ClientWidth = 6240
DrawStyle = 5 'Transparent
FillColor = &H00FFFFFF&
ForeColor = &H8000000E&
LinkTopic = "Form1"
ScaleHeight = 294
ScaleMode = 3 'Pixel
ScaleWidth = 416
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox picFly
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 4215
Left = 120
Picture = "动画_“蝴蝶飞舞”续集F.frx":0000
ScaleHeight = 279
ScaleMode = 3 'Pixel
ScaleWidth = 399
TabIndex = 0
Top = 120
Width = 6015
Begin VB.Timer Timer1
Interval = 500
Left = 240
Top = 3240
End
Begin VB.PictureBox picMask2
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1185
Left = 4320
Picture = "动画_“蝴蝶飞舞”续集F.frx":1866F6
ScaleHeight = 1155
ScaleWidth = 1155
TabIndex = 4
Top = 2880
Width = 1185
End
Begin VB.PictureBox picSour2
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1185
Left = 3120
Picture = "动画_“蝴蝶飞舞”续集F.frx":186ADC
ScaleHeight = 1155
ScaleWidth = 1155
TabIndex = 3
Top = 2880
Width = 1185
End
Begin VB.PictureBox picMask1
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1185
Left = 1920
Picture = "动画_“蝴蝶飞舞”续集F.frx":187766
ScaleHeight = 1155
ScaleWidth = 1155
TabIndex = 2
Top = 2880
Width = 1185
End
Begin VB.PictureBox picSour1
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1185
Left = 720
Picture = "动画_“蝴蝶飞舞”续集F.frx":187B4C
ScaleHeight = 1155
ScaleWidth = 1155
TabIndex = 1
Top = 2880
Width = 1185
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'“动画_透明处理”的窗体模块
Option Explicit
Dim lngP As Long
Dim lngR As Long
Private Sub Form_Load()
Timer1.Interval = 500
picFly.ScaleMode = 3 '象素
picFly.Picture = LoadPicture(App.Path & "\原野.bmp")
picSour1.AutoRedraw = True: picMask1.AutoRedraw = True
picSour2.AutoRedraw = True: picMask2.AutoRedraw = True
picSour1.Picture = LoadPicture(App.Path & "\Bfly1_Sour.bmp")
picMask1.Picture = LoadPicture(App.Path & "\Bfly1_Mask.bmp")
picSour2.Picture = LoadPicture(App.Path & "\Bfly2_Sour.bmp")
picMask2.Picture = LoadPicture(App.Path & "\Bfly2_Mask.bmp")
picSour1.Visible = False: picMask1.Visible = False
picSour2.Visible = False: picMask2.Visible = False
'播放声音
'SND_ASYNC:异步演播,在播放声音时可以作其他的事
'SND_LOOP:循环演播,播完后再重播。需与SND_ASYNC组合使用
sndPlaySound App.Path & "\wav300.wav", SND_ASYNC Or SND_LOOP
End Sub
'半秒钟系统自动引发Timer事件
Private Sub Timer1_Timer()
'声明计数器intC为整型的静态变量
Static intC As Integer
'lngX和lngY表示在原野上飞舞的蝴蝶的位置
Static lngX As Long
Static lngY As Long
'intC的初值为0
intC = intC + 1
'intC只有1和2两种取值
If intC = 3 Then intC = 1
'intC=1显示张开的蝴蝶
'intC=2显示闭和的蝴蝶
lngX = lngX + 10 '10是X方向的增量,以象素为单位
lngY = lngY + 5 '5是Y方向的增量,以象素为单位
If lngX > (picFly.Width - 40) Then
lngX = 0
lngY = 0
End If
If intC = 1 Then
picFly.Cls '清除蝴蝶飞舞所在的图片框
'对张开蝴蝶的透明处理
lngP = BitBlt(picFly.hDC, lngX, lngY, _
picMask1.Width, picMask1.Height, picMask1.hDC, 0, 0, SRCAND)
lngP = BitBlt(picFly.hDC, lngX, lngY, _
picSour1.Width, picSour1.Height, picSour1.hDC, 0, 0, SRCINVERT)
Else
picFly.Cls '清除蝴蝶飞舞所在的图片框
'对闭合蝴蝶的透明处理
lngP = BitBlt(picFly.hDC, lngX, lngY, _
picMask2.Width, picMask2.Height, picMask2.hDC, 0, 0, SRCAND)
lngP = BitBlt(picFly.hDC, lngX, lngY, _
picSour2.Width, picSour2.Height, picSour2.hDC, 0, 0, SRCINVERT)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -