📄 loginfm.pas
字号:
unit loginfm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Mask, jpeg, ExtCtrls,ADODB,db;
type
Tloginform = class(TForm)
Panel1: TPanel;
Image1: TImage;
Image2: TImage;
Panel2: TPanel;
Image3: TImage;
Panel3: TPanel;
Image4: TImage;
Label1: TLabel;
Image5: TImage;
Image6: TImage;
Image7: TImage;
Image8: TImage;
Label2: TLabel;
Label5: TLabel;
Label7: TLabel;
admin: TEdit;
pass: TMaskEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Image4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
loginform: Tloginform;
G_username:string;
G_flag:integer;
G_flagname:string;
implementation
uses aboutfm,dmfm,mainfm;
{$R *.dfm}
procedure Tloginform.FormShow(Sender: TObject);
begin
if Assigned(frmAbout) then
frmAbout.Hide;
end;
procedure Tloginform.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure Tloginform.BitBtn1Click(Sender: TObject);
var
aSQL:string;
begin
if (admin.Text='') or (pass.Text='') then
begin
application.MessageBox('用户名或密码不能为空!','明宇提示',48);
end
else if (G_username<>'') and (G_username=admin.Text) then
begin
application.MessageBox('你所选择的是当前操作员,请选择其他操作员进行换班!','明宇提示',48);
admin.Text:='';
pass.Text:='';
admin.SetFocus;
end
else
begin
with dm do
try
aq_admin.SQL.Clear;
aSQL:='select * from 管理员 where 用户名='+QuotedStr(admin.Text)+' and 密码='+QuotedStr(pass.text);
aq_admin.SQL.Add(aSQL);
aq_admin.Open;
if not aq_admin.Eof then
begin
G_username:=admin.Text;
G_flag:=aq_admin.FieldValues['权限'];
mainform.toolbutton5.Visible:=true;
mainform.SpeedButton1.Visible:=true;
mainform.SpeedButton2.Visible:=true;
mainform.SpeedButton4.Visible:=true;
if G_flag=0 then
begin
mainform.toolbutton6.Visible:=true;
mainform.toolbutton3.Visible:=true;
end;
mainform.toolbutton4.Caption:='换班';
if G_flag=0 then
G_flagname:='超级管理员'
else
G_flagname:='一般操作员';
mainform.stbMain.Panels[0].Text := '操作员:'+G_username+' 权限:'+G_flagname;
loginform.Close;
end
else
begin
Application.MessageBox('密码错误! ', '明宇提示', MB_OK +
MB_ICONWARNING + MB_DEFBUTTON3 + MB_TOPMOST);
pass.SetFocus;
end;
except
Application.MessageBox('连接数据库错误! ', '明宇提示', MB_OK +
MB_ICONWARNING + MB_DEFBUTTON3 + MB_TOPMOST);
end;
end;
end;
procedure Tloginform.Image4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, $F012, 0);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -