Un simple visualisateur de polices pour illustrer la fonction "screen.fonts"

Description

Comment charger toutes les polices de l'ordi en quelques lignes.
il faut :
- 1 Form
- 1 ComboBox (propriété "style" sur dropdownlist)
- 2 TextBox
- 1 Label
- 1 Hscroll
mettez tout ça dans la form, n'importe où.

Source / Exemple :


'-------------------------------------------------------------------------
'Attention le ComboBox doit avoir sa propriété "style" sur "DropDownList"
'-------------------------------------------------------------------------

Private Sub Combo1_Click()

Text1.Font = Combo1.List(Combo1.ListIndex)

Text1 = Text2

'certaines police reste en italique, donc :
Text1.FontItalic = False

End Sub

Private Sub Form_Load()

Dim I

'ici la fonction pour afficher toutes les polices dans le combo
For I = 1 To Screen.FontCount - 1
    Combo1.AddItem Screen.Fonts(I)
Next I

Combo1.Text = "Times New Roman"

HScroll1.Min = 8
HScroll1.Max = 200

Label1 = HScroll1.Value

Text2 = "Texte Exemple"

Text1.Alignment = 2

End Sub

Private Sub Form_Resize()

'evite un plantage si la form est réduite dans la barre des tâches
If Form1.WindowState = 1 Then Exit Sub

'donne une taille minimum à la form
If Form1.Height < 3315 Then Form1.Height = 3315
If Form1.Width < 9765 Then Form1.Width = 9765

Combo1.Top = 90
Combo1.Left = 120
Combo1.Width = 2895

HScroll1.Top = 120
HScroll1.Left = 3120
HScroll1.Width = 2295
HScroll1.Height = 255

Label1.Top = 120
Label1.Left = 5640
Label1.Width = 495
Label1.Height = 255

Text2.Top = 105
Text2.Left = 6360
Text2.Width = 3135
Text2.Height = 285

Text1.Top = Combo1.Top + Combo1.Height + 200
Text1.Left = 120
Text1.Width = Form1.Width - 350
Text1.Height = Form1.Height - Text1.Top - 700
End Sub

Private Sub HScroll1_Change()
Text1.FontSize = HScroll1.Value
Label1 = HScroll1.Value
Text1 = Text2
End Sub

Private Sub text2_Change()
Text1 = Text2
End Sub

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.