弹来弹去跑马灯!

Winfom TabControl 实现窗口TabPage 效果

不考虑用 DV Express 等第三方控件

 

可2中实现方法

1:系统API窗口劫持

[DllImport("user32.dll")]
private static extern int SetParent(IntPtr hWndChild, IntPtr hWndParent);

Form2 f2= new Form2();
f2.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f2.WindowState =FormWindowState.Maximized;
f2.Location = new Point(0,0);

SetParent(f2.Handle, tabControl1.TabPages[0].Handle);
f2.Show();

 

2:设置子窗口非顶级窗口


Form2 f2 = new Form2();
f2.TopLevel = false;//设置子窗口非顶级窗口
f2.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f2.WindowState = FormWindowState.Maximized;
tabPage2.Controls.Add(f2);
f2.Show();

 

现在剩下的就是 在每个 TabPage上绘制个关闭按钮。。。。。。。。。。。。。

绘制关闭按钮略。。。。。。。。。。

 

posted @ 2015-07-02 10:47  wgscd  阅读(317)  评论(0)    收藏  举报