|
-
Oct 13th, 2000, 04:21 PM
#1
Thread Starter
New Member
Is there any easy way to bring up a window with all the fonts avilable on a computer?
-
Oct 13th, 2000, 04:26 PM
#2
Hyperactive Member
Hows this ?
Code:
Private Sub Form_Load()
Dim intBuffer As Integer, strFont As String
'load printer fonts to combobox
If Dir$(App.Path & "\fonts.dat") = "" Then
'font file doesnt exist. Create it.
Open App.Path & "\fonts.dat" For Output As #1
For intBuffer% = 0 To Printer.FontCount - 1
Call cmbFonts.AddItem(Printer.Fonts(intBuffer%))
Print #1, Printer.Fonts(intBuffer%)
Next intBuffer%
Close #1
Else
'load fonts from file
Open App.Path & "\fonts.dat" For Input As #1
While Not EOF(1)
Input #1, strFont$
Call cmbFonts.AddItem(strFont$)
Wend
Close #1
End If
cmbFonts.ListIndex = 0
''cmbFonts.Sorted = True 'Alphabetize list
'set combobox to "Arial"
For intBuffer% = 0 To cmbFonts.ListCount - 1
If cmbFonts.List(intBuffer%) = "Arial" Then cmbFonts.ListIndex = intBuffer%: Exit For
Next intBuffer%
You need a list box
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Oct 13th, 2000, 04:29 PM
#3
transcendental analytic
You can enumerate a list using font object
Code:
For n = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(n)
Next n
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 04:31 PM
#4
Same goes for the Printer. Simply use kedaman's code and replace Screen with Printer.
-
Oct 13th, 2000, 07:03 PM
#5
If you want to use CommonDialog to do it:
Code:
Private Sub Command1_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth
CommonDialog1.ShowFont
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Size = CommonDialog1.FontSize
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
Exit Sub
ErrHandler:
Exit Sub
End Sub
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
|