[英]How do I clone everything inside a tabpage in code while creating a new tabpage
In winforms I am creating a browser based off of Gecko and I need the geckoBrowser1
, urlBar1 (not yet added)
and back/forwardArrow1 (not yet added)
to be added to a new tabPage upon it's creation. 在winforms中,我正在基于Gecko创建浏览器,并且需要在geckoBrowser1
, urlBar1 (not yet added)
和back/forwardArrow1 (not yet added)
添加到新的tabPage中。 My issue is copying these particular assets 我的问题是复制这些特定资产
I've already tried looking things up on google but they all talk about how to add a new tabpage from scratch. 我已经尝试过在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);
}
}
I expect the new tab I create to then take the Gecko browser and duplicate it into the new tab. 我希望我创建的新标签页能够使用Gecko浏览器并将其复制到新标签页中。
像这样:
tabPage.Controls.Add(geckoWebBrowser1);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.