Font size mismatch between RichTextBox and Word

放肆的年华 提交于 2019-12-06 01:27:27

问题


I have a small WPF application that hosts a RichTextBox:

<RichTextBox SpellCheck.IsEnabled="True" 
             FontFamily="Verdana"
             AcceptsTab="True"
             AcceptsReturn="True"
             FontSize="14" />

As shown the code snippet above, I set the font size to 14. If I copy text from this RichTextBox to Microsoft Word or Microsoft WordPad, the font size is reported to be 10.5. Similar oddities persist if I paste text from Word or WordPad. I have verified that the text being selected from my app is sized at 14. Any help would be greatly appreciated!


回答1:


Using FontSize and assigning a simple number means the unit is pixels. Try setting Fontsize="14pt" instead.

Other units: px, in, cm.



来源:https://stackoverflow.com/questions/1301397/font-size-mismatch-between-richtextbox-and-word

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!