using System; using System.Runtime.InteropServices; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.PublicForm { public partial class CheckPwd : CustomControl.BaseForm.BaseForm { //所有用到了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; string ErrorMessage; public CheckPwd() { InitializeComponent(); } private void Confirm_Click(object sender, EventArgs e) { if (LogicHandler.CheckUserLogin(UserName.Text, pwd.Text,SystemInf.CurrentDB ,out ErrorMessage)) { Close(); } else MessageBox.Show(ErrorMessage); } private void ChangePwd_Load(object sender, EventArgs e) { dh = SystemInf.dh; UserName.Text = BaseUtil.GetCacheData("LastLoginUser").ToString(); } private void checkpwd_TextChanged(object sender, EventArgs e) { } private void headBar1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } } }