📄 unit2.pas
字号:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, ExtCtrls, Db, DBTables;
type
TForm2 = class(TForm)
Label1: TLabel;
Panel1: TPanel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
ComboBox1: TComboBox;
Button1: TButton;
Button2: TButton;
SpeedButton1: TSpeedButton;
Table1: TTable;
Timer1: TTimer;
Timer2: TTimer;
procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
user:string;
mima:string;
pp:integer;
implementation
uses
unit1, Unit20;
{$R *.DFM}
procedure TForm2.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
table1.IndexName:='user';
table1.Open;
table1.SetKey ;
table1.FieldByName('姓名').asstring:=combobox1.Text ;
table1.GotoKey ;
if table1.GotoKey then
begin
edit1.visible:=true;
edit1.SetFocus;
user:=combobox1.Text
end
else
begin
application.MessageBox (pchar('无此用户!'),pchar('用户'),mb_ok+32);
combobox1.Text :='';
combobox1.SetFocus ;
end;
end;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
button1.Enabled :=false;
edit1.Visible :=false;
edit1.text:='';
combobox1.Text :='';
combobox1.SetFocus ;
end;
procedure TForm2.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if table1['密码']=edit1.Text then
begin
button1.Enabled:=true;
mima:=edit1.Text;
end
else
begin
application.MessageBox (pchar('密码错误!请您再次输入!'),pchar('访问'),mb_ok+32);
edit1.Text :='';
edit1.SetFocus ;
end;
end
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
if button1.Visible then
begin
form1.Show;
form2.visible:=false;
end;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
if pp=0 then
begin
if speedbutton1.left<=152 then
speedbutton1.Left:=speedbutton1.left+2
else
pp:=1;
end
else
begin
speedbutton1.left:=speedbutton1.left-2;
if speedbutton1.Left<32 then
pp:=0;
end;
end;
procedure TForm2.Timer2Timer(Sender: TObject);
begin
speedbutton1.Font.Color:=rgb(random(256),random(256),random(256));
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Session.AddPassword('hhb');
Table1.Active := True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -