EnumFont (3)




Public Sub Load_Fonts()
Dim nodX As Node
'Declare an object variable For the Node.

Dim i As Integer, f As Integer
'Declare a variable For use as a counter.

'Add one Node to the TreeView control,

'and call it the first node

Set nodX = TreeView1.Nodes.Add()
nodX.Text = "System Fonts"
For f = 0 To Screen.FontCount - 1
Call List1.AddItem(Screen.Fonts(f))
Next f
For i = 0 To List1.ListCount - 1
Set nodX = TreeView1.Nodes.Add(1, tvwChild)
nodX.Text = List1.List(i)
Next i
TreeView1.Nodes(1).Selected = True
nodX.EnsureVisible
End Sub

Private Sub Form_Load()
Call Load_Fonts
End Sub

Private Sub TreeView1_NodeClick(ByVal Node As Node)
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelFontName = (Node.Text)
RichTextBox1.SelLength = 0
End Sub
Assumes:
You need a Treeview (from mscomctl.ocx), RichTextBox,
and a Listbox










( enumfont3.html )- by Paolo Puglisi - Modifica del 17/12/2023