PRACTICA IV-13. uso de los objetos combobox y listbox para
crear un explorador de fuentes
EQUIPO No5
OBJETIVO.- Aprender a utilizar un objeto ComboBox, en un conjunto con uno ListBox que será alimentado en tiempo de ejecución con las fuentes de pantalla que tenga instalado su sistema.
PROCEDIMIENTO.- Para esta práctica el procedimiento es el siguiente:
Option Explicit
Private Sub cboTamanio_Change()
Dim inttamanio As Integer
If IsNumeric(cboTamanio.Text) Then
inttamanio%
= CInt(cboTamanio.Text)
Else
inttamanio%
= CInt(cboTamanio.Text)
End If
If inttamanio
> 32 Or inttamanio% <
8 Then
inttamanio%
= CInt(cboTamanio.List(0))
End If
lblMuestra.Font.Size
= inttamanio%
End Sub
Private Sub cboTamanio_Click()
lblMuestra.Font.Size
= _
CInt(cboTamanio.List(cboTamanio.ListIndex))
End Sub
Private Sub Form_Load()
Dim intContador As
Integer
For intContador%
= 0 To Screen.FontCount - 1
lstFuentes.AddItem
Screen.Fonts(intContador%)
Next intContador%
lstFuentes.Selected(0) = True
cboTamanio.AddItem
8
cboTamanio.AddItem
10
cboTamanio.AddItem
12
cboTamanio.AddItem
18
cboTamanio.AddItem
24
lblMuestra.Font.Name
= lstFuentes.List(0)
lblMuestra.Font.Size
= cboTamanio.List(0)
End Sub
Private Sub lstFuentes_Click()
lblMuestra.Font.Name = lstFuentes.List(lstFuentes.ListIndex)
End Sub
CONCLUSIONES: Muy interesante saber como llamar a todas las fuentes de nuestro sistema, y ademas la manupulacion de estas con combo box y list box.