【问题标题】:how to convert string data to html in richtextbox如何在richtextbox中将字符串数据转换为html
【发布时间】:2014-01-14 00:52:02
【问题描述】:

我在winform 中使用httpwebrequest 获取响应现在我想在我的winform 中将其显示为html 页面,为此我使用richtextbox 但它只是显示文本而不是html 请告诉我如何在这里做是我的代码

Uri uri = new Uri("http://www.google.com"); 如果(uri.Scheme == Uri.UriSchemeHttp){ HttpWebRequest 请求 = (HttpWebRequest)HttpWebRequest.Create(uri); request.Method = WebRequestMethods.Http.Get; HttpWebResponse 响应 = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); 字符串 tmp = reader.ReadToEnd(); richTextBox1.Text = tmp; }

【问题讨论】:

  • @LearningByCoding 我试试这个,但它不起作用这就是我问的原因
  • 好的,但是正如答案中提到的那样,这是不可能的。因此,提出无法执行的相同问题对我的朋友没有帮助。我希望您了解您将不得不使用其他一些控件。看到richtextbox的基本任务是显示文本,有一些额外的好处,而不是显示html内容。

标签: c# winforms httpwebrequest


【解决方案1】:

有一个.Net控件允许在winforms中编辑html,

看看http://winformhtmltextbox.codeplex.com/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-03
    • 2015-10-24
    • 2012-11-07
    • 1970-01-01
    • 1970-01-01
    • 2020-08-06
    • 2011-11-11
    • 2014-03-12
    相关资源
    最近更新 更多