📄 frmlock.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hotel.Operation;
namespace Hotel.UI
{
public partial class frmLock : Form
{
private Point mouseOffset;
private Point mousePos;
public bool isPwd = false;
UserInfoAccess objUserInfoAccess = null;
public frmLock()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
//关闭系统
DialogResult dr = MessageBox.Show("是否关闭系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dr==DialogResult.Yes)
{
Application.Exit();
}
}
private void txtPwd_KeyPress(object sender, KeyPressEventArgs e)
{
//按回车键确定
if (e.KeyChar == (char)13)
btnUndo_Click(sender, e);
}
private void btnUndo_Click(object sender, EventArgs e)
{
string pwd = txtPwd.Text.Trim();
objUserInfoAccess = new UserInfoAccess();
//判断用户输入是否为空
if (txtPwd.Text == string.Empty)
{
MessageBox.Show("密码不能为空,请输入密码!","提示");
}
//判断用户输入的密码是否正确
else if (objUserInfoAccess.LockPwd(pwd))
{
isPwd = true;
this.Close();
}
else
{
MessageBox.Show("您输入的密码是错误的,请重新输入!", "提示");
txtPwd.Focus();
}
{
}
}
private void frmLock_Load(object sender, EventArgs e)
{
this.ActiveControl = txtPwd;
}
private void frmLock_MouseDown(object sender, MouseEventArgs e)
{
mouseOffset = new Point(-e.X, -e.Y);
}
private void frmLock_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
//是否左击
mousePos = Control.MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
Location = mousePos;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -