From 237ca231a4cf35da78c1e474f3d6bc8dc657d13f Mon Sep 17 00:00:00 2001 From: jtsshieh Date: Wed, 30 Aug 2017 06:52:49 -0400 Subject: [PATCH] Made the maximize not cover the taskbar --- Histacom2.Engine/Template/WinClassic.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Histacom2.Engine/Template/WinClassic.cs b/Histacom2.Engine/Template/WinClassic.cs index 23ea562..20e66f0 100644 --- a/Histacom2.Engine/Template/WinClassic.cs +++ b/Histacom2.Engine/Template/WinClassic.cs @@ -205,10 +205,13 @@ private void border_MouseDown(object sender, MouseEventArgs e) WinClassic_Activated(null, null); } - public bool max = false; + public bool max = false; + public Size prevSize; + public Point prevPoint; private void maximizebutton_Click(object sender, EventArgs e) { + if (max == false) { this.right.Hide(); @@ -220,7 +223,10 @@ private void maximizebutton_Click(object sender, EventArgs e) this.topleftcorner.Hide(); this.toprightcorner.Hide(); this.Dock = DockStyle.Fill; - this.WindowState = FormWindowState.Maximized; + prevSize = this.Size; + prevPoint = this.Location; + this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height - 28); + this.Location = new Point(0, 0); max = true; maximizebutton.Image = Engine.Properties.Resources.WinClassicRestore; } @@ -235,11 +241,12 @@ private void maximizebutton_Click(object sender, EventArgs e) this.topleftcorner.Show(); this.toprightcorner.Show(); this.Dock = DockStyle.None; - this.WindowState = FormWindowState.Normal; + this.Size = prevSize; + this.Location = prevPoint; max = false; maximizebutton.Image = Engine.Properties.Resources.WinClassicMax; } - + } // The rest of this code will automatically style the buttons on the form!