日期:2014-05-18  浏览次数:20973 次

将sql中的html代码正确显示在c# winform中
如题

------解决方案--------------------
C# code
using System;
using System.Windows.Forms;

class Test : Form
{
  Test()
  {
    WebBrowser w   = new WebBrowser();
    w.Parent       = this;
    w.Dock         = DockStyle.Fill;
    w.DocumentText =
      "<html><body>Please enter your name:<br/>" +
      "<input type='text' name='userName'/><br/>" +
      "<a href='http://www.microsoft.com'>continue</a>" +
      "</body></html>";
  }

  [STAThread]
  static void Main()
  {
    Application.Run(new Test());
  }
}

------解决方案--------------------
探讨
C# codeusing System;
using System.Windows.Forms;

class Test : Form
{
Test()
{
WebBrowser w = new WebBrowser();
w.Parent = this;
w.Dock = DockStyle.Fill;
w.DocumentText =
"<html><body>Please enter your name:<br/>" +
"<input type='text' name='userName'/><br/>" +
"<a href='http://www.microsoft.com'>continue</a>" +
"</body></…

------解决方案--------------------
WebBrowser, need add reference axhost
------解决方案--------------------
引用System.web.dll,使用System.Web.HttpUtility.HtmlDecode