WPF html格式用richtextbox显示出来 Show HTML in RichTextBox

郁闷 写好提交结果没成功,刚写好的都不见了。没有心情再写了。直接保存代码

 

 

string abc2 = ("<FlowDocument xmlns=/"http://schemas.microsoft.com/winfx/2006/xaml/presentation/"><Paragraph><Bold>haha</Bold><LineBreak /><Italic>yeye</Italic><Bold>haha</Bold></Paragraph></FlowDocument>"); string abc = ("<p><b>haha</b><br /><i>yeye</i><b>haha</b></p>"); TextRange range = new TextRange(txtRichText.Document.ContentStart, txtRichText.Document.ContentEnd); using (MemoryStream msDocument = new MemoryStream((new ASCIIEncoding()).GetBytes(abc2))) { FlowDocument _formattedDocument = XamlReader.Load(msDocument) as FlowDocument; txtRichText.Document = _formattedDocument; }

 

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/09c0d0da-5d69-49fb-ab06-7e9f47326816

http://blogs.msdn.com/jfoscoding/archive/2006/01/16/513383.aspx

http://www.c-sharpcorner.com/UploadFile/mahesh/WPFRichTextBox09072008194855PM/WPFRichTextBox.aspx

http://www.codeproject.com/KB/WPF/htmltextblock.aspx

你可能感兴趣的:(html,c,String,WPF)