Winforms 窗口应用中的Web浏览器控件
您好,我正在使用此代码:Winforms 窗口应用中的Web浏览器控件,winforms,Winforms,您好,我正在使用此代码: private void Form1_Load(object sender, EventArgs e) { webBrowser1.Navigate("about:blank"); HtmlDocument doc = webBrowser1.Document; doc.Write("<b><i>My Name</i> is Not </b> Khan.&l
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("about:blank");
HtmlDocument doc = webBrowser1.Document;
doc.Write("<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.");
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("about:blank");
HtmlDocument doc = webBrowser1.Document;
doc.Write("<b><i>My Name</i> is Not </b> Khan.<b>");
}
private void Form1\u加载(对象发送方,事件参数e)
{
webBrowser1.导航(“关于:空白”);
HtmlDocument doc=webBrowser1.文档;
写下(“我的名字不是可汗。我的名字不是可汗。我的名字不是可汗。我的名字不是可汗。”);
}
私有无效按钮1\u单击(对象发送者,事件参数e)
{
webBrowser1.导航(“关于:空白”);
HtmlDocument doc=webBrowser1.文档;
写下(“我的名字不是汗。”);
}
但当我单击按钮时,webBrowser1显示为空白。请尝试以下代码:
private void Form1_Load(object sender, EventArgs e)
{
string strText = "<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.<b><i>My Name</i> is Not </b> Khan.";
webBrowser1.Navigate("about:blank");
HtmlDocument objHtmlDoc = this.webBrowser1.Document;
objHtmlDoc.Write(String.Empty);
webBrowser1.DocumentText = strText;
}
private void button1_Click(object sender, EventArgs e)
{
string strText="<b><i>My Name</i> is Not </b> Khan.<b>";
webBrowser1.Navigate("about:blank");
HtmlDocument objHtmlDoc = this.webBrowser1.Document;
objHtmlDoc.Write(String.Empty);
webBrowser1.DocumentText = strText;
}
private void Form1\u加载(对象发送方,事件参数e)
{
string strText=“我的名字不是汗。我的名字不是汗。我的名字不是汗。我的名字不是汗。”;
webBrowser1.导航(“关于:空白”);
HtmlDocument objHtmlDoc=this.webBrowser1.Document;
objHtmlDoc.Write(String.Empty);
webBrowser1.DocumentText=strText;
}
私有无效按钮1\u单击(对象发送者,事件参数e)
{
string strText=“我的名字不是汗。”;
webBrowser1.导航(“关于:空白”);
HtmlDocument objHtmlDoc=this.webBrowser1.Document;
objHtmlDoc.Write(String.Empty);
webBrowser1.DocumentText=strText;
}