1
0
mirror of synced 2025-02-25 22:38:07 +01:00

Disable mdi buttons when all tabs are closed

This commit is contained in:
KillzXGaming 2019-03-28 16:27:21 -04:00
parent 183b093997
commit c40ba88f6c
2 changed files with 23 additions and 22 deletions

Binary file not shown.

View File

@ -39,9 +39,7 @@ namespace Toolbox
//Redo setting this since designer keeps resetting this
tabForms.myBackColor = FormThemes.BaseTheme.FormBackColor;
BtnMdiClose.Visible = false;
BtnMdiMinMax.Visible = false;
BtnMdiMinimize.Visible = false;
OnMdiWindowClosed();
}
public void Reload()
@ -689,9 +687,7 @@ namespace Toolbox
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
BtnMdiClose.Visible = false;
BtnMdiMinMax.Visible = false;
BtnMdiMinimize.Visible = false;
OnMdiWindowClosed();
//Force garbage collection.
GC.Collect();
@ -704,7 +700,10 @@ namespace Toolbox
{
foreach (Form frm in this.MdiChildren) frm.Close();
Switch_Toolbox.Library.RenderTools.DisposeTextures();
OnMdiWindowClosed();
RenderTools.DisposeTextures();
//Force garbage collection.
GC.Collect();
@ -713,6 +712,20 @@ namespace Toolbox
GC.WaitForPendingFinalizers();
}
private void OnMdiWindowClosed()
{
BtnMdiClose.Visible = false;
BtnMdiMinMax.Visible = false;
BtnMdiMinimize.Visible = false;
}
private void OnMdiWindowActived()
{
BtnMdiClose.Visible = true;
BtnMdiMinMax.Visible = true;
BtnMdiMinimize.Visible = true;
}
private void minimizeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ActiveMdiChild != null)
@ -870,18 +883,9 @@ namespace Toolbox
return;
if (ActiveMdiChild.WindowState == FormWindowState.Maximized)
{
BtnMdiClose.Visible = true;
BtnMdiMinMax.Visible = true;
BtnMdiMinimize.Visible = true;
}
OnMdiWindowActived();
else
{
BtnMdiClose.Visible = false;
BtnMdiMinMax.Visible = false;
BtnMdiMinimize.Visible = false;
}
OnMdiWindowClosed();
}
private const int WM_SETREDRAW = 11;
@ -1010,10 +1014,7 @@ namespace Toolbox
{
if (child == tabForms.SelectedTab.Tag)
{
BtnMdiClose.Visible = false;
BtnMdiMinMax.Visible = false;
BtnMdiMinimize.Visible = false;
OnMdiWindowClosed();
child.Close();
return;
}