Search Tools Links Login

^ Font Properties ^


Visual Basic 6, or VB Classic

This little coding lets the user see how many fonts they have and what they can do with it..this is kind of old..but i was bored.

Original Author: iNfO

Inputs

3 - CommandButtons (Command1, Command2, Command3)
1 - Listbox (List1)
1 - Label (Label1)

Code

'- Made By: iNfO
'- Project: ^ Font Properties ^
'- Items Needed:
'-       3 - CommandButtons (Command1, Command2, Command3)
'-       1 - Listbox (List1)
'-       1 - Label (Label1)
Private Sub Command1_Click()
'- Declares the variables
Dim NUM As Single
Dim x As Single
'- gets the numbers of fonts you have
NUM = Screen.FontCount
'- Set the listbox properties
'- Set List1, Sorted = True
'- Goes from 1 to number of fonts
For x = 1 To NUM
  List1.AddItem Screen.Fonts(x)
Next x
'- for some reason there will be a blank itme
'- this removes it
List1.RemoveItem (0)
'- Displays the number of fonts
Label2.Caption = List1.ListCount
End Sub
Private Sub Command2_Click()
'- Makes sure that there are fonts to choose from
If List1.ListCount <> 0 Then
  '- this makes the fonts watever you select from
  '- the listbox
  Label1.Font = List1.Text
Else
  MsgBox "you have to choose the fonts first"
End If
End Sub
Private Sub Command3_Click()
'- Makes sure that there are fonts to choose from
If List1.ListCount <> 0 Then
  '- Declares the variables
  Dim Size As Single
  '- lets it inputbox get the font size
  '- Makes it a value
  Size = Val(InputBox("Enter the font size"))
  Label1.FontSize = Val(Size)
Else
  MsgBox "you have to choose the fonts first"
End If
End Sub
Private Sub Form_Load()
'- Sets the captions of the buttons
Command1.Caption = "Get Fonts"
Command2.Caption = "Apply Fonts"
Command3.Caption = "Get Fonts Size"
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 87 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.