aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Engine
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-07-28 10:58:58 -0400
committerlempamo <[email protected]>2017-07-28 10:58:58 -0400
commit9205136293b7bc77e570baaffdf0836c3aeef2aa (patch)
treed46a2c677afe9e98aad9c95299aaf5a5e114c692 /TimeHACK.Engine
parenta2e42d26db125d4dc4718adc015c223e5534b806 (diff)
downloadhistacom2-9205136293b7bc77e570baaffdf0836c3aeef2aa.tar.gz
histacom2-9205136293b7bc77e570baaffdf0836c3aeef2aa.tar.bz2
histacom2-9205136293b7bc77e570baaffdf0836c3aeef2aa.zip
window resizing (not working yet)
Diffstat (limited to 'TimeHACK.Engine')
-rw-r--r--TimeHACK.Engine/Template/WinClassic.Designer.cs8
-rw-r--r--TimeHACK.Engine/Template/WinClassic.cs29
2 files changed, 36 insertions, 1 deletions
diff --git a/TimeHACK.Engine/Template/WinClassic.Designer.cs b/TimeHACK.Engine/Template/WinClassic.Designer.cs
index bb6b752..b1d4b82 100644
--- a/TimeHACK.Engine/Template/WinClassic.Designer.cs
+++ b/TimeHACK.Engine/Template/WinClassic.Designer.cs
@@ -159,6 +159,7 @@
this.toprightcorner.Name = "toprightcorner";
this.toprightcorner.Size = new System.Drawing.Size(4, 4);
this.toprightcorner.TabIndex = 6;
+ this.toprightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// bottomrightcorner
//
@@ -169,6 +170,7 @@
this.bottomrightcorner.Name = "bottomrightcorner";
this.bottomrightcorner.Size = new System.Drawing.Size(4, 4);
this.bottomrightcorner.TabIndex = 4;
+ this.bottomrightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// bottomleftcorner
//
@@ -178,6 +180,7 @@
this.bottomleftcorner.Name = "bottomleftcorner";
this.bottomleftcorner.Size = new System.Drawing.Size(4, 4);
this.bottomleftcorner.TabIndex = 2;
+ this.bottomleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// topleftcorner
//
@@ -186,6 +189,7 @@
this.topleftcorner.Name = "topleftcorner";
this.topleftcorner.Size = new System.Drawing.Size(4, 4);
this.topleftcorner.TabIndex = 1;
+ this.topleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// left
//
@@ -195,6 +199,7 @@
this.left.Name = "left";
this.left.Size = new System.Drawing.Size(4, 292);
this.left.TabIndex = 3;
+ this.left.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// bottom
//
@@ -206,6 +211,7 @@
this.bottom.Name = "bottom";
this.bottom.Size = new System.Drawing.Size(296, 4);
this.bottom.TabIndex = 5;
+ this.bottom.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// right
//
@@ -216,6 +222,7 @@
this.right.Name = "right";
this.right.Size = new System.Drawing.Size(4, 296);
this.right.TabIndex = 7;
+ this.right.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// top
//
@@ -226,6 +233,7 @@
this.top.Name = "top";
this.top.Size = new System.Drawing.Size(300, 4);
this.top.TabIndex = 8;
+ this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(border_MouseDown);
//
// WinClassic
//
diff --git a/TimeHACK.Engine/Template/WinClassic.cs b/TimeHACK.Engine/Template/WinClassic.cs
index 554d6be..55ebb9a 100644
--- a/TimeHACK.Engine/Template/WinClassic.cs
+++ b/TimeHACK.Engine/Template/WinClassic.cs
@@ -10,6 +10,7 @@ namespace TimeHACK.Engine.Template
public WinClassic()
{
InitializeComponent();
+ DoubleBuffered = true;
}
public System.Drawing.Font fnt;
@@ -17,8 +18,19 @@ namespace TimeHACK.Engine.Template
public bool closeDisabled = false;
public const int WM_NCLBUTTONDOWN = 0xA1;
+ public const int WM_SYSCOMMAND = 0x0112;
public const int HT_CAPTION = 0x2;
+ private const int
+ HTLEFT = 10,
+ HTRIGHT = 11,
+ HTTOP = 12,
+ HTTOPLEFT = 13,
+ HTTOPRIGHT = 14,
+ HTBOTTOM = 15,
+ HTBOTTOMLEFT = 16,
+ HTBOTTOMRIGHT = 17;
+
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
@@ -39,7 +51,7 @@ namespace TimeHACK.Engine.Template
if (!closeDisabled) this.Close();
}
- public bool max = false;
+ public bool max = false;
private void maximizebutton_Click(object sender, EventArgs e)
{
@@ -114,5 +126,20 @@ namespace TimeHACK.Engine.Template
var c = (Button)sender;
c.UseVisualStyleBackColor = true;
}
+
+ private void border_MouseDown(object sender, EventArgs e)
+ {
+ var cursor = this.PointToClient(Cursor.Position);
+
+ if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0);
+ else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0);
+ else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0);
+ else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0);
+
+ else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0);
+ else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0);
+ else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0);
+ else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0);
+ }
}
}