-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathViIcon.cls
50 lines (41 loc) · 1.27 KB
/
ViIcon.cls
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
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ViIcon"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_Handle As Long
Private m_hr As Long
Private m_pidl As SHFILEINFOW
Public IconPath As String
'Public IconFlags As Long
Public Function DrawIconEx(ByVal destinationHdc As Long, X As Long, Y As Long, cxIcon As Long, cyIcon As Long)
win.DrawIconEx destinationHdc, X, Y, m_Handle, cxIcon, cyIcon, 0, 0, DI_NORMAL
End Function
Public Function DrawIcon(ByVal destinationHdc As Long, X As Long, Y As Long)
'ImageList_Draw m_hr, m_Handle, destinationHdc, X, Y, ILD_TRANSPARENT
win.DrawIconEx destinationHdc, X, Y, m_Handle, 16, 16, 0, 0, DI_NORMAL
End Function
Public Property Let Handle(newHandle As Long)
FlushIcon
m_Handle = newHandle
End Property
Public Property Get Handle() As Long
Handle = m_Handle
End Property
Public Function FlushIcon()
Class_Terminate
End Function
Private Sub Class_Terminate()
If m_Handle <> 0 Then
DestroyIcon ByVal m_Handle
End If
End Sub