forked from lee-soft/ViPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GDIFont.cls
69 lines (56 loc) · 1.95 KB
/
GDIFont.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "GDIFont"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
Private Const DEFAULT_CHARSET As Long = 1
'local variable(s) to hold property value(s)
Private mvarHandle As Long 'local copy
Private mvarFontFace As String 'local copy
Private mvarFontWeight As Long 'local copy
Private mvarItalic As bool 'local copy
Public Property Get Handle() As Long
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Handle
Handle = mvarHandle
End Property
Public Property Get FontWeight() As Long
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FontWeight
FontWeight = mvarFontWeight
End Property
Public Property Get FontFace() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FontFace
FontFace = mvarFontFace
End Property
Public Property Get Italic() As bool
Italic = mvarItalic
End Property
Public Function Constructor(Optional ByVal FontFace As String = "Tahoma", Optional ByVal FontWeight As Long = 15, Optional ByVal Italic As bool = APIFALSE)
If mvarHandle <> 0 Then
DeleteObject mvarHandle
End If
mvarFontFace = FontFace
mvarFontWeight = FontWeight
mvarItalic = Italic
mvarHandle = CreateFont(FontWeight, 0, 0, 0, 0, Italic, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, mvarFontFace)
End Function
Private Sub Class_Initialize()
Constructor "Tahoma", 0
End Sub
Private Sub Class_Terminate()
If mvarHandle <> 0 Then
DeleteObject mvarHandle
End If
End Sub