读书人

将sql中的html代码正确显示在c# winfo

发布时间: 2012-01-23 21:57:28 作者: rapoo

将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

读书人网 >C#

热点推荐