?? 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 + -