home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch11 / enmfntx.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.7 KB  |  125 lines

  1. VERSION 5.00
  2. Begin VB.Form enmfntx 
  3.    Caption         =   "Enum Font Example"
  4.    ClientHeight    =   3690
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1500
  7.    ClientWidth     =   7215
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    LinkTopic       =   "Form1"
  19.    PaletteMode     =   1  'UseZOrder
  20.    ScaleHeight     =   3690
  21.    ScaleWidth      =   7215
  22.    Begin VB.ListBox List2 
  23.       Height          =   1395
  24.       Left            =   60
  25.       TabIndex        =   4
  26.       Top             =   600
  27.       Width           =   6975
  28.    End
  29.    Begin VB.CommandButton cmdListTrueType 
  30.       Appearance      =   0  'Flat
  31.       BackColor       =   &H80000005&
  32.       Caption         =   "List All TrueType"
  33.       Height          =   435
  34.       Left            =   1560
  35.       TabIndex        =   3
  36.       Top             =   120
  37.       Width           =   1755
  38.    End
  39.    Begin VB.CommandButton CmdListVariations 
  40.       Appearance      =   0  'Flat
  41.       BackColor       =   &H80000005&
  42.       Caption         =   "List Variations"
  43.       Height          =   435
  44.       Left            =   5280
  45.       TabIndex        =   2
  46.       Top             =   120
  47.       Width           =   1755
  48.    End
  49.    Begin VB.CommandButton CmdListFonts 
  50.       Appearance      =   0  'Flat
  51.       BackColor       =   &H80000005&
  52.       Caption         =   "List All Fonts"
  53.       Height          =   435
  54.       Left            =   3420
  55.       TabIndex        =   1
  56.       Top             =   120
  57.       Width           =   1755
  58.    End
  59.    Begin VB.ListBox List1 
  60.       Height          =   1200
  61.       Left            =   60
  62.       TabIndex        =   0
  63.       Top             =   2280
  64.       Width           =   6975
  65.    End
  66.    Begin VB.Label Label2 
  67.       BackStyle       =   0  'Transparent
  68.       Caption         =   "Font variations with a family:"
  69.       Height          =   255
  70.       Left            =   60
  71.       TabIndex        =   6
  72.       Top             =   2040
  73.       Width           =   2595
  74.    End
  75.    Begin VB.Label Label1 
  76.       BackStyle       =   0  'Transparent
  77.       Caption         =   "Font families:"
  78.       Height          =   255
  79.       Left            =   60
  80.       TabIndex        =   5
  81.       Top             =   300
  82.       Width           =   1395
  83.    End
  84. Attribute VB_Name = "enmfntx"
  85. Attribute VB_GlobalNameSpace = False
  86. Attribute VB_Creatable = False
  87. Attribute VB_PredeclaredId = True
  88. Attribute VB_Exposed = False
  89. Option Explicit
  90. ' Copyright 
  91.  1997 by Desaware Inc. All Rights Reserved.
  92. Private Sub CmdListVariations_Click()
  93.     Dim di&
  94.     Dim fname$
  95.     Dim f%
  96.     List1.Clear
  97.     fname$ = List2.Text
  98.     f% = InStr(fname$, " -- ")
  99.     If f% > 0 Then
  100.         fname$ = Left$(fname$, f% - 1)
  101.     End If
  102.     ' This gets Arial only (all styles)
  103.     di = EnumFontFamilies(hdc, fname$, AddressOf Callback1_EnumFonts, 2)
  104. End Sub
  105. Private Sub CmdListFonts_Click()
  106.     Dim di&
  107.     List1.Clear
  108.     List2.Clear
  109.     ' This gets one font for each family
  110.     di = EnumFontFamilies(hdc, vbNullString, AddressOf Callback1_EnumFonts, 0)
  111. End Sub
  112. Private Sub cmdListTrueType_Click()
  113.     Dim di&
  114.     List1.Clear
  115.     List2.Clear
  116.     ' This gets one font for each family
  117.     ' Danger - be sure to use vbNullString, not 0!  Nasty VB type conversion!
  118.     di = EnumFontFamilies(hdc, vbNullString, AddressOf Callback1_EnumFonts, 1)
  119. End Sub
  120. Private Sub Form_Load()
  121. End Sub
  122. Private Sub List2_Click()
  123.     CmdListVariations_Click
  124. End Sub
  125.