private void frmMain_MdiChildActivate(object sender, EventArgs e)
{
//this.SuspendLayout();
//DrawingControl.SuspendUpdate.Suspend(this);
// If child form is new and no has tabPage,
// create new tabPage
if (this.MdiChildren.Count() > 0)
{
if (this.ActiveMdiChild != null && this.ActiveMdiChild.Tag == null)
{
// Add a tabPage to tabControl with child
// form caption
TabPage tp = new TabPage(this.ActiveMdiChild.Text);
tp.Tag = this.ActiveMdiChild;
tp.ToolTipText = this.ActiveMdiChild.Text;
tp.Parent = tabForms;
tabForms.SelectedTab = tp;
this.ActiveMdiChild.Tag = tp;
this.ActiveMdiChild.FormClosed += new FormClosedEventHandler(ActiveMdiChild_FormClosed);
//this.ActiveMdiChild.SizeChanged += new EventHandler(ActiveMdiChild_SizeChanged);
}
else
{
tabForms.SelectedTab = this.ActiveMdiChild.Tag as TabPage;
}
tabStack.Add(tabForms.SelectedTab);
}
else
{
tabForms.TabPages.Clear();
}
//this.ResumeLayout();
//DrawingControl.SuspendUpdate.Resume(this);
if (this.ActiveMdiChild != null ) this.ActiveMdiChild.Refresh();
else tabForms.TabPages.Clear();
//SourceCodeMarkUp.SendMessage(this.Handle, SourceCodeMarkUp.WM_NCPAINT, 0, IntPtr.Zero);
tabForms.Update();
}