how to set RTF from WinForms to WPF RichTextBox

删除回忆录丶 提交于 2019-12-13 19:09:32

问题


how to set RTF from WinForms to WPF RichTextBox. (Not by TextRange.Load()).

I have a string variable which has rtf text. I want to set this variable to wpf ritch text box.


回答1:


I got the solution.

MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text));
ritchTextBox.Selection.Load(stream, DataFormats.Rtf);


来源:https://stackoverflow.com/questions/3003984/how-to-set-rtf-from-winforms-to-wpf-richtextbox

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