⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imagefiles.cls

📁 VB6.0编写的医院影像系统
💻 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 = "ImageFiles"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Option Explicit

Private mcolImageFiles As New Collection

Public Function Add(FileFullName As String, Optional FileLimit As String = "ALL") As ImageFile
    
    '------------------------
    '对于ImageFiles的集合,Add操作要
    '尽量简单,加快速度
    '------------------------
    
    Dim NewImageFile As New ImageFile
    
    '检查是否存在
    If FSO.FileExists(FileFullName) = False Then Set Add = Nothing: Exit Function
    Select Case UCase(Right(FileFullName, 3))
        Case "BMP", "GIF", "JPG", "ICO", "CUR", "WMF"
            If FileLimit = "VIDEO" Then
                Set Add = Nothing
                Exit Function
            End If
            
        Case "AVI"
            If FileLimit = "IMAGE" Then
                Set Add = Nothing
                Exit Function
            End If
            
            
        Case Else
            Set Add = Nothing
            Exit Function
    End Select
    NewImageFile.FileFullName = FileFullName
    mcolImageFiles.Add NewImageFile

    '为新的 ImageFile 返回一个引用。
    Set Add = NewImageFile
    
    '释放对象
    Set NewImageFile = Nothing
    
End Function


Public Function Insert(ImageFile As ImageFile)

    '加入对已经有的ImageFile的引用
    mcolImageFiles.Add ImageFile

End Function

Public Property Get Count() As Long
    
    '返回ImageFiles集合中ImageFile的数目
    Count = mcolImageFiles.Count
    
End Property

Public Sub Delete(ByVal Index As Variant)
    
    '删除ImageFiles集合中的ImageFile(Index)
    mcolImageFiles.Remove Index
    
End Sub
    
Public Function Item(ByVal Index As Variant) As ImageFile
Attribute Item.VB_UserMemId = 0
    
    '返回选择的Item
    Set Item = mcolImageFiles.Item(Index)
    
End Function

Public Function NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
    
    '这样可以设置For...Each...Next调用
    Set NewEnum = mcolImageFiles.[_NewEnum]
    
End Function
    

Public Sub Clear()
    
    '清空集合
    Set mcolImageFiles = Nothing
    
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -