|
|
|
|
|
Dim hFont As Long
Dim v As Variant
If List1.ListIndex = -1 Then Exit Sub
pic.Refresh
' Get the face name
v = Split(List1.List(List1.ListIndex), "_", -1
' Create the logical font
hFont = CreateFont( _
-MulDiv(14, GetDeviceCaps(hdc, LOGPIXELSY), 72), _
0, _
0, _
0, _
FW_NORMAL, _
0, _
0, _
0, _
ANSI_CHARSET, _
OUT_DEFAULT_PRECIS, _
CLIP_DEFAULT_PRECIS, _
DEFAULT_QUALITY, _
DEFAULT_PITCH, _
V(0))
' Select into the picture box
SelectObject pic.hdc, hFont
' Draw text in picture box
TextOut pic.hdc, 0, 0, "This is " & List1.List(List1.ListIndex), _
Len("This is " & List1.List(List1.ListIndex))
' Delete font when done
DeleteObject hFont
End Sub
|
|
|