📄 yonghudenglu.pas
字号:
unit yonghudenglu;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Buttons, DB, ADODB;
type
Tyonghudenglufrm = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure pyonghudenglu;
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
yonghudenglufrm: Tyonghudenglufrm;
m:integer = 0;
s:boolean = false;
czy:string;
implementation
uses dbdata,main;
{$R *.dfm}
procedure Tyonghudenglufrm.SpeedButton1Click(Sender: TObject);
begin
m:=m+1;
if edit1.Text='' then
application.MessageBox('请输入用户名','提示',64)
else
if edit2.Text='' then
application.MessageBox('请输入密码','提示',64)
else
pyonghudenglu;
end;
procedure Tyonghudenglufrm.SpeedButton2Click(Sender: TObject);
begin
if s=false then
application.Terminate
else
close;
end;
procedure Tyonghudenglufrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if s=false then
application.Terminate;
close;
end;
procedure Tyonghudenglufrm.pyonghudenglu;
begin
with data.ADOlogin do
begin
close;
sql.Clear;
sql.Add('select * from 操作员信息表 where 操作员名称 = :a and 操作员密码 = :b');
parameters.ParamByName('a').Value:=trim(edit1.Text);
parameters.ParamByName('b').Value:=trim(edit2.Text);
open;
end;
if data.ADOlogin.RecordCount>0 then
begin
czy:=data.ADOlogin.FieldByName('操作员名称').Value;
s:=true;
mainfrm.StatusBar1.Panels[1].Text:=czy;
mainfrm.statusbar1.Panels[3].Text:=datetostr(date());
mainfrm.statusbar1.Panels[5].Text:=timetostr(time());
yonghudenglufrm.Hide;
mainfrm.Show;
end
else
if m<3 then
begin
application.MessageBox('用户名或密码错误,请重新输入!','提示',64);
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
end
else
begin
application.MessageBox('您无权使用本系统!','提示',64);
Application.Terminate;
end;
end;
procedure Tyonghudenglufrm.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = vk_Return) or(Key = vk_Down) then
Edit2.SetFocus;
end;
procedure Tyonghudenglufrm.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((Key = vk_Return) or(Key = vk_Down)) then
speedButton1Click(Sender)
else
Edit2.SetFocus;
if Key = vk_Up then
Edit1.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -