FontDialog in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the FontDialog control


FontDialog

Visual Basic offers a wide range of dialog boxes that allow the user to make standard selections and each of them has a very specific purpose.

The purpose of the FontDialog is selecting a font letting the user specify a font's characteristics like a name, size, boldness, and so on.

This component displays a font selection dialog, and has several properties that determine the options that the dialog displays and the types of fonts it will allow the user to select.

    Private Sub FontDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        CurrentFont.Text = "Current font - " & Me.Font.Name
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles FontButton.Click
        If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.Font = FontDialog1.Font
            CurrentFont.Text = "Current font - " & FontDialog1.Font.Name
        End If
    End Sub


standard font

dialog box

result

Previous Lesson | Next Lesson


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.