📄 tape.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsTape"
Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
Attribute VB_Creatable = False
Attribute VB_TemplateDerived = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Customizable = False
'**********************************************
' 用于 VCR 示例应用程序的类模块。
' 就像 VCR 的磁带输送装置一样,
' 控制着图像的“回放”。
'**********************************************
Option Explicit
Public Left As Integer '最后的位置
Public Forward As Boolean '走带方向
Public Speed As Integer '磁带速度
'**********************************************
' 目的: 为每一幅动画计算新座标。
' 输入: 宽度: 播放动画的图片框的宽度
'**********************************************
Public Sub Animate(Width As Integer)
If Forward = True Then
' 向前走 - 增加当前的 left 值
' 直到到达右边界
If Left < Width - 50 Then
Left = Left + 50
Else
Left = 0
End If
Else
' 倒带 - 减少当前的 left 值直到到达左边界
If Left > 0 Then
Left = Left - 50
Else
Left = Width - 50
End If
End If
End Sub
Private Sub Class_Initialize()
' 初始化类属性
Forward = True
Left = 0
Speed = 300
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -