📄 imagefile.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ImageFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_File As File
'附加的属性
Public m_TagSave As Boolean '是否保存
Public m_TagSound As Boolean '是否有声音
Public m_TagPrint As Boolean '是否打印
Public SoundFile As String '对应的声音文件名
Public Frames As Long '帧数
Public Property Get TagSound() As Boolean
TagSound = m_TagSound
End Property
Public Property Let TagSound(NewValue As Boolean)
m_TagSound = NewValue
If NewValue Then
m_TagSave = True
End If
End Property
Public Property Get TagPrint() As Boolean
TagPrint = m_TagPrint
End Property
Public Property Let TagPrint(NewValue As Boolean)
m_TagPrint = NewValue
If NewValue Then
m_TagSave = True
End If
End Property
Public Property Get TagSave() As Boolean
TagSave = m_TagSave
End Property
Public Property Let TagSave(NewValue As Boolean)
m_TagSave = NewValue
End Property
Public Property Get FileFullName() As String
On Error GoTo ErrHandle
'读取全部路径
FileFullName = m_File.Path
Exit Property
ErrHandle:
FileFullName = vbNullString
End Property
Public Property Let FileFullName(NewValue As String)
On Error Resume Next
'全部路径
Set m_File = FSO.GetFile(NewValue)
End Property
Public Property Get Directory() As String
'父目录
Directory = m_File.ParentFolder
End Property
Public Property Get FileName() As String
On Error GoTo ErrHandle
'文件名
FileName = m_File.Name
Exit Property
ErrHandle:
FileName = vbNullString
End Property
Public Property Get FileExtension() As String
'返回文件的扩展名
Dim i As Integer
For i = 1 To Len(m_File.Name)
If Left(Right(m_File.Name, i), 1) = "." Then GoTo FindEx
Next i
FileExtension = vbNullString
Exit Property
FindEx:
FileExtension = Right(m_File.Name, i - 1)
End Property
Public Property Get FileMainName() As String
'返回文件的名称(不含扩展名)
Dim i As Integer
For i = 1 To Len(m_File.Name)
If Left(Right(m_File.Name, i), 1) = "." Then GoTo FindMain
Next i
FileMainName = m_File.Name
Exit Property
FindMain:
FileMainName = Left(m_File.Name, Len(m_File.Name) - i)
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -