diff options
Diffstat (limited to 'TimeHACK.Engine/Template/WinClassic.cs')
| -rw-r--r-- | TimeHACK.Engine/Template/WinClassic.cs | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/TimeHACK.Engine/Template/WinClassic.cs b/TimeHACK.Engine/Template/WinClassic.cs index aa72263..1bd11e3 100644 --- a/TimeHACK.Engine/Template/WinClassic.cs +++ b/TimeHACK.Engine/Template/WinClassic.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace TimeHACK.Engine.Template @@ -16,5 +10,63 @@ namespace TimeHACK.Engine.Template { InitializeComponent(); } + + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HT_CAPTION = 0x2; + + [DllImportAttribute("user32.dll")] + public static extern int SendMessage(IntPtr hWnd, + int Msg, int wParam, int lParam); + [DllImportAttribute("user32.dll")] + public static extern bool ReleaseCapture(); + + private void programtopbar_drag(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + ReleaseCapture(); + SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); + } + } + + private void closebutton_Click(object sender, EventArgs e) + { + this.Close(); + } + + public Boolean max = false; + + private void maximizebutton_Click(object sender, EventArgs e) + { + if (max == false) + { + this.right.Hide(); + this.left.Hide(); + this.bottom.Hide(); + this.top.Hide(); + this.bottomleftcorner.Hide(); + this.bottomrightcorner.Hide(); + this.topleftcorner.Hide(); + this.toprightcorner.Hide(); + this.Dock = DockStyle.Fill; + max = true; + maximizebutton.Image = Properties.Resources.WinClassicRestore; + } + else + { + this.right.Show(); + this.left.Show(); + this.bottom.Show(); + this.top.Show(); + this.bottomleftcorner.Show(); + this.bottomrightcorner.Show(); + this.topleftcorner.Show(); + this.toprightcorner.Show(); + this.Dock = DockStyle.None; + max = false; + maximizebutton.Image = Properties.Resources.WinClassicMax; + } + + } } } |
