Hcsy 8 жил өмнө
parent
commit
b2d93be3e9

+ 4 - 2
UAS-MES/PublicForm/ChangePwd.Designer.cs

@@ -171,11 +171,13 @@
             this.headBar1.Size = new System.Drawing.Size(331, 32);
             this.headBar1.Size = new System.Drawing.Size(331, 32);
             this.headBar1.TabIndex = 0;
             this.headBar1.TabIndex = 0;
             this.headBar1.Title = null;
             this.headBar1.Title = null;
+            this.headBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.headBar1_MouseDown);
             // 
             // 
             // ChangePwd
             // ChangePwd
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
             this.ClientSize = new System.Drawing.Size(331, 211);
             this.ClientSize = new System.Drawing.Size(331, 211);
             this.Controls.Add(this.UserName);
             this.Controls.Add(this.UserName);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.label1);
@@ -188,9 +190,9 @@
             this.Controls.Add(this.mc_madeqty_label);
             this.Controls.Add(this.mc_madeqty_label);
             this.Controls.Add(this.headBar1);
             this.Controls.Add(this.headBar1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "ChangePwd";
             this.Name = "ChangePwd";
-            this.Tag = "ChangePwd";
+            this.Tag = "ShowDialogWindow";
             this.Text = "ChangePwd";
             this.Text = "ChangePwd";
             this.Load += new System.EventHandler(this.ChangePwd_Load);
             this.Load += new System.EventHandler(this.ChangePwd_Load);
             this.ResumeLayout(false);
             this.ResumeLayout(false);

+ 25 - 0
UAS-MES/PublicForm/ChangePwd.cs

@@ -4,6 +4,7 @@ using System.ComponentModel;
 using System.Data;
 using System.Data;
 using System.Drawing;
 using System.Drawing;
 using System.Linq;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Text;
 using System.Windows.Forms;
 using System.Windows.Forms;
 using UAS_MES.DataOperate;
 using UAS_MES.DataOperate;
@@ -15,6 +16,23 @@ namespace UAS_MES.PublicForm
     public partial class ChangePwd : Form
     public partial class ChangePwd : Form
     {
     {
 
 
+        //所有用到了headBar的部分都需要这段代码
+        [DllImport("user32.dll")]
+        public static extern bool ReleaseCapture();
+
+        [DllImport("user32.dll")]
+        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
+
+        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
+        public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
+
+        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
+        public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
+
+        public const int WM_SYSCOMMAND = 0x0112;
+        public const int SC_MOVE = 0xF010;
+        public const int HTCAPTION = 0x0002;
+
         DataHelper dh;
         DataHelper dh;
         string ErrorMessage;
         string ErrorMessage;
 
 
@@ -43,6 +61,7 @@ namespace UAS_MES.PublicForm
             dh = new DataHelper();
             dh = new DataHelper();
             UserName.Text = BaseUtil.GetCacheData("LastLoginUser").ToString();
             UserName.Text = BaseUtil.GetCacheData("LastLoginUser").ToString();
             Confirm.Enabled = false;
             Confirm.Enabled = false;
+  
         }
         }
 
 
         private void checkpwd_TextChanged(object sender, EventArgs e)
         private void checkpwd_TextChanged(object sender, EventArgs e)
@@ -55,5 +74,11 @@ namespace UAS_MES.PublicForm
                 Confirm.Enabled = true;
                 Confirm.Enabled = true;
             }
             }
         }
         }
+
+        private void headBar1_MouseDown(object sender, MouseEventArgs e)
+        {
+            ReleaseCapture();
+            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
+        }
     }
     }
 }
 }