-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDustbin.bas
54 lines (50 loc) · 1.56 KB
/
Dustbin.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Attribute VB_Name = "Dustbin"
Dim MyMembers() As Object, MyMembers2()
Sub AddMember(Member As Object)
ReDim Preserve MyMembers(UBound(MyMembers) + 1)
Set MyMembers(UBound(MyMembers)) = Member
End Sub
Sub AddImageMember(Member As Long)
ReDim Preserve MyMembers2(UBound(MyMembers2) + 1)
MyMembers2(UBound(MyMembers2)) = Member
End Sub
Sub DelImageMember(Member As Long)
For i = 1 To UBound(MyMembers2)
If MyMembers2(i) = Member Then
MyMembers2(i) = MyMembers2(UBound(MyMembers2))
ReDim Preserve MyMembers2(UBound(MyMembers2) - 1)
Exit For
End If
Next
End Sub
Function IsDelAllImage() As Boolean
If UBound(MyMembers2) = 0 Then IsDelAllImage = True
End Function
Sub InitDustbin()
ReDim MyMembers(0)
ReDim MyMembers2(0)
End Sub
Sub DoClearing()
On Error Resume Next
For i = 1 To UBound(MyMembers2)
If MyMembers2(i) <> 0 Then
Debug.Print Now, "正在回收第" & i & "项(1/2):Gdip Image"
GdipDisposeImage MyMembers2(i)
End If
Next
ReDim MyMembers2(0)
For i = 1 To UBound(MyMembers)
Debug.Print Now, "正在回收第" & i & "项(2/2):" & TypeName(MyMembers(i))
MyMembers(i).Dispose
Next
End Sub
Public Sub CreateImage(ByVal filename As Long, bitmap As Long)
Dim Img As Long
GdipCreateBitmapFromFile filename, Img
AddImageMember Img
bitmap = Img
End Sub
Public Sub DelImage(bitmap As Long)
GdipDisposeImage bitmap
DelImageMember bitmap
End Sub