Get the font in a FontDialog : Font Dialog « GUI Windows Form « C# / C Sharp






Get the font in a FontDialog

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


public class MainClass {
    private FontDialog fontDlg = new FontDialog();
    private Font currFont = new Font("Times New Roman", 12);

    public static void Main() {
        FontDialog fontDlg = new FontDialog();
        if (fontDlg.ShowDialog() != DialogResult.Cancel) {
            Console.WriteLine(fontDlg.Font);
        }
    }
}

 








Related examples in the same category

1.Color Dialog and Font DialogColor Dialog and Font Dialog