本人在编写《小说朗读器》时设计了设置保存和提取功能,其中RichTextBox字体设置的保存和提取比较复杂,查了一些资料,终于找到了解决方法,与大家共享:
1、字体保存成字符串
Dim fc As New FontConverter
strFont = fc.ConvertToInvariantString(RichTextBox1.Font)
2、由字符串转成字体
Dim fc As New FontConverter
RichTextBox1.Font = fc.ConvertFromString(strFont)
本方法的优点就是由字符串转成字体很方便!特别是有Font.Style的情况下。