VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "字体格式"
   ClientHeight    =   4320
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5565
   LinkTopic       =   "Form1"
   ScaleHeight     =   4320
   ScaleWidth      =   5565
   StartUpPosition =   3  '窗口缺省
   Begin VB.ListBox List1 
      Height          =   1140
      Left            =   3930
      TabIndex        =   0
      TabStop         =   0   'False
      Top             =   735
      Width           =   1515
   End
   Begin VB.Frame Frame1 
      Caption         =   "格式设置"
      Height          =   2250
      Left            =   90
      TabIndex        =   11
      Top             =   2010
      Width           =   5400
      Begin VB.OptionButton Option1 
         Caption         =   "右对齐"
         Height          =   255
         Index           =   2
         Left            =   135
         TabIndex        =   10
         Top             =   1785
         Width           =   960
      End
      Begin VB.OptionButton Option1 
         Caption         =   "居中对齐"
         Height          =   285
         Index           =   1
         Left            =   120
         TabIndex        =   9
         Top             =   1440
         Width           =   1170
      End
      Begin VB.OptionButton Option1 
         Caption         =   "左对齐"
         Height          =   225
         Index           =   0
         Left            =   135
         TabIndex        =   8
         Top             =   1155
         Width           =   1095
      End
      Begin VB.ComboBox Combo3 
         Height          =   1440
         ItemData        =   "Form1.frx":0000
         Left            =   3825
         List            =   "Form1.frx":0002
         Style           =   1  'Simple Combo
         TabIndex        =   7
         Text            =   "Combo3"
         Top             =   540
         Width           =   1350
      End
      Begin VB.ComboBox Combo2 
         Height          =   1440
         Left            =   2130
         Style           =   1  'Simple Combo
         TabIndex        =   5
         Text            =   "Combo2"
         Top             =   540
         Width           =   1440
      End
      Begin VB.CheckBox Check1 
         Caption         =   "应用字体大小"
         Height          =   255
         Index           =   2
         Left            =   3840
         TabIndex        =   6
         Top             =   240
         Width           =   1380
      End
      Begin VB.CheckBox Check1 
         Caption         =   "应用字体样式"
         Height          =   330
         Index           =   1
         Left            =   2070
         TabIndex        =   4
         Top             =   180
         Width           =   1455
      End
      Begin VB.CheckBox Check1 
         Caption         =   "应用字体"
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   2
         Top             =   225
         Width           =   1455
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   105
         TabIndex        =   3
         Text            =   "Combo1"
         Top             =   600
         Width           =   1920
      End
   End
   Begin VB.Label Label3 
      Caption         =   "字体格式演示"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   1755
      TabIndex        =   13
      Top             =   105
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "当前格式："
      Height          =   255
      Left            =   3915
      TabIndex        =   12
      Top             =   525
      Width           =   1080
   End
   Begin VB.Label Label1 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "字体演示 "
      Height          =   870
      Left            =   300
      TabIndex        =   1
      Top             =   705
      Width           =   3375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click(Index As Integer)
    '通过数组下标来判断单击了哪个复选框，并执行相应内容
    Select Case Index
        Case 0
            If Check1(0) = 1 Then
                Combo1_Click            '调用Combo1_Click( )过程
            Else
                Label1.FontName = "宋体"    '设置字体
            End If
        Case 1
            If Check1(1) = 1 Then
                Combo2_Click            '调用Combo2_Click( )过程
            Else
                Label1.FontBold = False     '设置为非粗体
                Label1.FontItalic = False   '设置为非斜体
            End If
            
        Case 2
            If Check1(2) = 1 Then
                Combo3_Click            '调用Combo3_Click( )过程
            Else
                Label1.FontSize = 9        '设置字体大小
            End If
    End Select
            
End Sub

Private Sub Combo1_Click()              '组合框列表项被选择（单击）
    If Check1(0) = 1 Then               '如果复选框被选中
        Label1.FontName = Combo1.Text   '设置字体
        List1.List(0) = Combo1.Text     '改变List1列表框字体项
    End If
End Sub

Private Sub Combo2_Click()
    If Check1(1) = 1 Then               '如果复选框被选中
        '设置粗体与斜体格式
        Select Case Combo2.Text
            Case "常规"
                Label1.FontBold = False
                Label1.FontItalic = False
            Case "粗体"
                Label1.FontBold = True
                Label1.FontItalic = False
            Case "斜体"
                Label1.FontBold = False
                Label1.FontItalic = True
            Case "粗斜体"
                Label1.FontBold = True
                Label1.FontItalic = True
        End Select
        List1.List(1) = Combo2.Text     '改变List1列表框字体格式项
    End If

End Sub

Private Sub Combo3_Change()         '组合框文字改变
    If Check1(2) = 1 Then
         If Val(Combo3.Text) > 0 Then
            Label1.FontSize = Val(Combo3.Text)
            List1.List(2) = Combo3.Text
         End If
    End If
End Sub

Private Sub Combo3_Click()
    If Check1(2) = 1 Then                   '如果复选框被选中
        If Val(Combo3.Text) > 0 Then
            Label1.FontSize = Val(Combo3.Text) '设置字体大小
            List1.List(2) = Combo3.Text         '改变List1列表框字体大小项
        End If
     End If
End Sub

Private Sub Form_Load()
    '初始化组合框
    Combo1.AddItem "宋体", 0        '为组合框增加列表项
    Combo1.AddItem "楷体_GB2312", 1
    Combo1.AddItem "隶书", 2
    Combo1.AddItem "黑体", 3
    Combo1.AddItem "幼圆", 4
    Combo1.ListIndex = 0            '设置当前选择的列表项
    
    Combo2.AddItem "常规", 0
    Combo2.AddItem "粗体", 1
    Combo2.AddItem "斜体", 2
    Combo2.AddItem "粗斜体", 3
    Combo2.ListIndex = 0
    
    Combo3.AddItem "9", 0
    Combo3.AddItem "12", 1
    Combo3.AddItem "16", 2
    Combo3.AddItem "18", 3
    Combo3.AddItem "20", 4
    Combo3.AddItem "24", 5
    Combo3.AddItem "28", 6
    Combo3.ListIndex = 0
    
    '初始化列表框
    List1.List(0) = Combo1.Text
    List1.List(1) = Combo2.Text
    List1.List(2) = Combo3.Text
    
    '设置单选按钮组的初始选项
    Option1(0).Value = True
End Sub

Private Sub Option1_Click(Index As Integer)
    '判断哪个单选按钮被选中，并执行相应动作
    Select Case Index
        Case 0
            Label1.Alignment = 0    '标签左对齐
        Case 1
            Label1.Alignment = 2    '标签文字居中对齐
        Case 2
            Label1.Alignment = 1    '标签文字右对齐
    End Select
End Sub
