我在 Windows 窗体应用程序中尝试了一个完整的 Firefox。我添加了一些添加标签页,但无法通过单击关闭。我不知道在标签页上粘贴一个十字按钮。我的编码部分是:-
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedTab.Text == "+")
{
AddNewTab();
}
foreach (Control item in tabControl1.SelectedTab.Controls)
{
if (item.GetType() == typeof(WebBrowser))
{
WebBrowser wb = (WebBrowser)item;
toolStripButton1.Enabled = wb.CanGoBack;
toolStripButton2.Enabled = wb.CanGoForward;
}
}
this.wb.DocumentTitleChanged += Browser_DocumentTitleChanged;
this.wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
我的封闭函数——
private void tabPage1_Click(object sender, EventArgs e)
{
if (tabControl1.SelectedTab != null)
{
tabControl1.SelectedTab.Dispose();
}
}
此功能通过双击关闭标签页,我想借助与 FireFox 工作相同的按钮关闭标签页