.NET如何实现将Form嵌入到分页
时间:2011-03-26 来源:24 3 8
我们经常用的浏览器都是分页式的操作起来很方便,当然我们希望能把其加入到我们的程序中来,其实实现起来很简单,先不废话上图先:
当然也要有右键和双击事件了:
是不是看着还行,源码如下:
private void tvMain_MouseClick(object sender, MouseEventArgs e) { DevComponents.DotNetBar.TabItem tabItemNew = new DevComponents.DotNetBar.TabItem(); DevComponents.DotNetBar.TabControlPanel tabControlPanelNew = new DevComponents.DotNetBar.TabControlPanel(); tabControlPanelNew.Dock = System.Windows.Forms.DockStyle.Fill; tabControlPanelNew.Name = "TestPanle" tabControlPanelNew.TabItem = tabItemNew; tabItemNew.AttachedControl = tabControlPanelNew; tabItemNew.Name = "TestItem" tabItemNew.Text = "测试窗体";
tabControlMain.Controls.Add(tabControlPanelNew); tabControlMain.Tabs.Add(tabItemNew);
Form1 mdiForm = new Form1(); mdiForm.FormBorderStyle = FormBorderStyle.None; mdiForm.TopLevel = false; mdiForm.Parent = tabControlPanelNew; mdiForm.Dock = DockStyle.Fill; tabControlPanelNew.Controls.Add(mdiForm); mdiForm.Show(); tabControlMain.Refresh(); tabControlMain.SelectedTab = tabItemNew; } }
相关阅读 更多 +