日期:2014-05-18 浏览次数:20998 次
private void button2_Click(object sender, EventArgs e) { bool have = false; foreach (TabPage a in tabControl1.TabPages) { if (a.Name == "KKK") //tabpage名 kkk { have = true; } } if (!have) { TabPage TabPageCity1 = new TabPage("KKK"); TabPageCity1.Name = "KKK"; this.tabControl1.TabPages.Add(TabPageCity1); FormCity frmCity = new FormCity(); //FormCity:From frmCity.TopLevel = false; frmCity.Parent = TabPageCity1; frmCity.ControlBox = false; frmCity.Dock = System.Windows.Forms.DockStyle.Fill; frmCity.Show(); this.tabControl1.SelectedTab = TabPageCity1; } else { MessageBox.Show("cz"); } }
------解决方案--------------------
设置FormBorderStyle为None就没有标题栏了~