在winforms中我创建了一个基于Gecko的浏览器,我需要在创建时将geckoBrowser1
,urlBar1 (not yet added)
和back/forwardArrow1 (not yet added)
添加到新的tabPage中。我的问题是复制这些特定资产
我已经尝试过在Google上查找内容,但他们都在讨论如何从头开始添加新的标签页。
private void button1_Click(object sender, EventArgs e)
{
//newTab is the "New Tab" button
GeckoWebBrowser geckoWebBrowser1 = new GeckoWebBrowser();
string title = "tabPage" + (tabControl1.TabCount + 1).ToString();
TabPage tabPage = new TabPage(title);
tabControl1.TabPages.Add(tabPage);
//I want to add the geckoWebBrowser1 into a new tab here
if (newTab.Location.X < Form1.ActiveForm.Width - 50)
{
newTab.Location = new Point(60 * tabControl1.TabCount - 2, 0);
}
else
{
newTab.Location = new Point(newTab.Location.X, newTab.Location.Y);
}
}
我希望我创建的新选项卡然后使用Gecko浏览器并将其复制到新选项卡中。
像这样的东西:
tabPage.Controls.Add(geckoWebBrowser1);