📄 unit11.pas
字号:
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm11 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
ComboBox1: TComboBox;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form11: TForm11;
entertime:integer;
implementation
{$R *.dfm}
procedure TForm11.FormCreate(Sender: TObject);
begin
entertime:=0;
end;
procedure TForm11.BitBtn1Click(Sender: TObject);
var
pwfile1:textfile;
password1:string;
pwfile2:textfile;
password2:string;
begin
if ComboBox1.text='教师' then
begin
assignfile(pwfile1,'教师登录密码.txt');
reset(pwfile1);
readln(pwfile1,password1);
closefile(pwfile1);
inc(entertime);
if edit1.text=Password1 then
close
else
begin
label1.Caption:='密码输入错误,请重新输入:';
if entertime>=3 then
begin
messagebox(handle,'输入密码错误超过三次,程序退出!','信息',MB_ok);
close;
application.terminate;
end else
begin
edit1.Text:='';
edit1.SetFocus;
end;
end;
end
else
begin
assignfile(pwfile2,'学生登录密码.txt');
reset(pwfile2);
readln(pwfile2,password2);
closefile(pwfile2);
inc(entertime);
if edit1.text=Password2 then
close
else
begin
label1.Caption:='密码输入错误,请重新输入:';
if entertime>=3 then
begin
messagebox(handle,'输入密码错误超过三次,程序退出!','信息',MB_ok);
close;
application.terminate;
end else
begin
edit1.Text:='';
edit1.SetFocus;
end;
end;
end;
end;
procedure TForm11.BitBtn2Click(Sender: TObject);
begin
close;
application.terminate;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -