日期:2014-05-17 浏览次数:21254 次
private void opentab(string tabtext, Form frm)
{
foreach (TabItem tabp in this.tabControl1.Tabs)
{
if (tabp.Text == tabtext)
{
tabp.Visible = true;
tabControl1.SelectedTab = tabp;
return;
}
}
frm.TopLevel = false;
frm.FormBorderStyle = FormBorderStyle.None;
frm.Text = tabtext;
frm.BackColor = this.BackColor;
frm.AutoScroll = true;
TabItem tp = new TabItem();
tp.Text = tabtext;
tp.ImageIndex = 3;
TabControlPanel tcp = new TabControlPanel();
tcp.Dock = DockStyle.Fill;
tcp.Location = new System.Drawing.Point(0, 0);
tcp.Padding = new System.Windows.Forms.Padding(2);
tcp.TabItem = tp;
tp.AttachedControl = tcp;
tcp.Controls.Add(frm);
tabControl1.Tabs.Add(tp);
tabControl1.Controls.Add(tcp);
tabControl1.Refresh();
tabControl1.SelectedTab = tp;
frm.Dock = DockStyle.Fill;
&nb