开发者

how to set RTF from WinForms to WPF RichTextBox

开发者 https://www.devze.com 2023-01-03 07:21 出处:网络
how to set RTF from WinForms to WPF RichTextBox. (Not by TextRange.Load()). I have a string variable which has rtf text.

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 s开发者_运维知识库et this variable to wpf ritch text box.


I got the solution.

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号