private const int SB_BOTH = 3;
private const int WM_NCCALCSIZE = 0x83;
[DllImport("user32.dll")]
private static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
protected override void WndProc(ref Message m)
{
if (mdiClient != null)
{
ShowScrollBar(mdiClient.Handle, SB_BOTH, 0 /*Hide the ScrollBars*/);
}
base.WndProc(ref m);
}
MdiClient mdiClient = null;
TTWorkPlan ttWorkPlan = new TTWorkPlan(); //子窗口
TTWorkRecord ttWorkRecord = new TTWorkRecord(); //子窗口
public TTWorkManagementSystem()
{
InitializeComponent();
}
private void TTWorkManagementSystem_Load(object sender, EventArgs e)
{
foreach (Control c in this.Controls) //Find the MdiClient in the MdiWindow
{
if (c is MdiClient)
{
mdiClient = c as MdiClient;
}
}
ttWorkPlan.MdiParent = this; //设置子窗口父窗口
ttWorkRecord.MdiParent = this; //设置子窗口父窗口
ttWorkRecord.Hide(); //隐藏子窗口
ttWorkPlan.Show(); //显示子窗口
}