Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Globalization
Imports System.Text
Imports System.Collections
Public Class MainClass
Shared Sub Main()
Dim myform As Form = New FontFamiliesForm()
Application.Run(myform)
End Sub
End Class
Public Class FontFamiliesForm
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents groupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents installedFamiliesListBox As System.Windows.Forms.ListBox
Friend WithEvents groupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents familiesListBox As System.Windows.Forms.ListBox
Friend WithEvents splitter1 As System.Windows.Forms.Splitter
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.groupBox2 = New System.Windows.Forms.GroupBox()
Me.installedFamiliesListBox = New System.Windows.Forms.ListBox()
Me.groupBox1 = New System.Windows.Forms.GroupBox()
Me.familiesListBox = New System.Windows.Forms.ListBox()
Me.splitter1 = New System.Windows.Forms.Splitter()
Me.groupBox2.SuspendLayout()
Me.groupBox1.SuspendLayout()
Me.SuspendLayout()
'
'groupBox2
'
Me.groupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.installedFamiliesListBox})
Me.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill
Me.groupBox2.Location = New System.Drawing.Point(139, 0)
Me.groupBox2.Name = "groupBox2"
Me.groupBox2.Size = New System.Drawing.Size(153, 310)
Me.groupBox2.TabIndex = 5
Me.groupBox2.TabStop = False
Me.groupBox2.Text = "Installed Font Families"
'
'installedFamiliesListBox
'
Me.installedFamiliesListBox.Dock = System.Windows.Forms.DockStyle.Fill
Me.installedFamiliesListBox.IntegralHeight = False
Me.installedFamiliesListBox.Location = New System.Drawing.Point(3, 16)
Me.installedFamiliesListBox.Name = "installedFamiliesListBox"
Me.installedFamiliesListBox.Size = New System.Drawing.Size(147, 291)
Me.installedFamiliesListBox.TabIndex = 0
'
'groupBox1
'
Me.groupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.familiesListBox})
Me.groupBox1.Dock = System.Windows.Forms.DockStyle.Left
Me.groupBox1.Location = New System.Drawing.Point(3, 0)
Me.groupBox1.Name = "groupBox1"
Me.groupBox1.Size = New System.Drawing.Size(136, 310)
Me.groupBox1.TabIndex = 3
Me.groupBox1.TabStop = False
Me.groupBox1.Text = "Font Families"
'
'familiesListBox
'
Me.familiesListBox.Dock = System.Windows.Forms.DockStyle.Fill
Me.familiesListBox.IntegralHeight = False
Me.familiesListBox.Location = New System.Drawing.Point(3, 16)
Me.familiesListBox.Name = "familiesListBox"
Me.familiesListBox.Size = New System.Drawing.Size(130, 291)
Me.familiesListBox.TabIndex = 0
'
'splitter1
'
Me.splitter1.Name = "splitter1"
Me.splitter1.Size = New System.Drawing.Size(3, 310)
Me.splitter1.TabIndex = 4
Me.splitter1.TabStop = False
'
'FontFamiliesForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 310)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.groupBox2, Me.groupBox1, Me.splitter1})
Me.Name = "FontFamiliesForm"
Me.Text = "FontFamiliesForm"
Me.groupBox2.ResumeLayout(False)
Me.groupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub FontFamiliesForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim family As FontFamily
For Each family In FontFamily.Families
If family.IsStyleAvailable(FontStyle.Bold) = False Then Exit For
familiesListBox.Items.Add(family.Name)
Next family
Dim installedFonts As InstalledFontCollection = New InstalledFontCollection()
For Each family In installedFonts.Families
installedFamiliesListBox.Items.Add(family.Name)
Next family
End Sub
End Class
|