From 2ec13402619bd4e2106f6c2a63c0c7929091f169 Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Tue, 22 Sep 2015 02:01:23 -0400 Subject: [PATCH] fix "Only TrueType fonts are supported. This is not a TrueType font." --- shadowsocks-csharp/View/LogForm.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/shadowsocks-csharp/View/LogForm.cs b/shadowsocks-csharp/View/LogForm.cs index c4fcaf51..3f4bc847 100644 --- a/shadowsocks-csharp/View/LogForm.cs +++ b/shadowsocks-csharp/View/LogForm.cs @@ -134,11 +134,19 @@ namespace Shadowsocks.View private void ChangeFontButton_Click(object sender, EventArgs e) { - FontDialog fd = new FontDialog(); - fd.Font = LogMessageTextBox.Font; - if (fd.ShowDialog() == DialogResult.OK) + try { - LogMessageTextBox.Font = fd.Font; + FontDialog fd = new FontDialog(); + fd.Font = LogMessageTextBox.Font; + if (fd.ShowDialog() == DialogResult.OK) + { + LogMessageTextBox.Font = new Font(fd.Font.FontFamily, fd.Font.Size, fd.Font.Style); + } + } + catch (Exception ex) + { + Logging.LogUsefulException(ex); + MessageBox.Show(ex.Message); } }