using DevExpress.XtraEditors; using System.Drawing; using System.Windows.Forms; using ZJ_BYD.DB; namespace ZJ_BYD.UserControls { public partial class ModifyPwd : XtraUserControl { public ModifyPwd() { InitializeComponent(); } #region 窗体移动 Point mouseOff;//鼠标移动位置变量         bool leftFlag;//标签是否为左键 private void frm_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mouseOff = new Point(-e.X, -e.Y); leftFlag = true; } } private void frm_MouseMove(object sender, MouseEventArgs e) { if (leftFlag) { Point mouseSet = Control.MousePosition; mouseSet.Offset(mouseOff.X, mouseOff.Y);//设置移动后的位置                 Location = mouseSet; } } private void frm_MouseUp(object sender, MouseEventArgs e) { if (leftFlag) { leftFlag = false;//释放鼠标后标注为False             } } #endregion private void btnsave_Click(object sender, System.EventArgs e) { var pwd = txtnewpwd.Text; var confirmPwd = txtConfirmPwd.Text; if (pwd != confirmPwd) { XtraMessageBox.Show("新口令和确认口令不一致!"); return; } var updateRows = CurrentConfigHelper.UpdateMenuPwd(pwd); if (updateRows > 0) { XtraMessageBox.Show("操作成功!"); } else { XtraMessageBox.Show("操作失败!"); } } } }