|
-
Apr 2nd, 2003, 12:01 PM
#1
Thread Starter
Fanatic Member
font list
Does anybody know where i could get a list of fonts (i.e. the fonts that come with ms word) that i can load into a combo box?
-
Apr 2nd, 2003, 12:07 PM
#2
Frenzied Member
You mean like this?
VB Code:
Dim Counter As Long
For Counter = 0 To Screen.FontCount - 1
Combo1.AddItem Screen.Fonts(Counter)
Next
-
Apr 2nd, 2003, 12:16 PM
#3
Thread Starter
Fanatic Member
That works, but I was kinda hoping i could see what the fonts look like, just like in ms word.
-
Apr 2nd, 2003, 12:32 PM
#4
Frenzied Member
Why don't you use the Common Dialog Control and use the ShowFont method?
Or do you want to see them on the form? I don't know a way to display multiple fonts in a standard Combo box. You could do it in a RichTextBox, though
-
Apr 2nd, 2003, 12:44 PM
#5
Frenzied Member
Here's a way to use a RichTextBox control to display the font names in their particular font. First, add a RichTextBox control to your form and make it big enough to display a long font name. Also, set the Scrollbars property to "3 - rtfBoth".
VB Code:
Private Sub Form_Load()
Dim nCounter As Integer
Dim nCurPos As Integer
Me.Show
With RichTextBox1
.Font.Size = 12
.Text = ""
For nCounter = 0 To Screen.FontCount - 2
.Text = .Text & Screen.Fonts(nCounter) & vbNewLine
Next
.Text = .Text & Screen.Fonts(nCounter + 1)
Do
.SelStart = nCurPos + 1
nCurPos = InStr(nCurPos + 1, .Text, Chr(13))
If nCurPos > 0 Then
.SelLength = nCurPos - .SelStart
Else
.SelLength = Len(.Text) - .SelStart
End If
.SelFontName = Trim(.SelText)
Loop Until nCurPos = 0
.SelStart = 0
End With
End Sub
-
Apr 2nd, 2003, 01:20 PM
#6
Thread Starter
Fanatic Member
So there is no way i can display multiple fonts in a standard combo box? Ok, but is there a non standard combo box i could use?
-
Apr 2nd, 2003, 01:53 PM
#7
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|