📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Button1: TButton;
Button2: TButton;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
Timer1: TTimer;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2, Unit3, Unit4;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
begin
AdoQuery1.Close;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select * from 管理员 where 用户名='''+Edit1.text+''' and 密码='''+Edit2.Text+''' ');
AdoQuery1.Open;
if ADOQuery1.RecordCount=1 then
begin
Form2.Panel1.Visible:=true;
timer1.Enabled:=true;
Form2.StatusBar1.Panels[1].Text:=Form2.StatusBar1.Panels[1].Text+Edit1.Text;
Form2.StatusBar1.Panels[4].Text:='0';
//Edit1.Text:='';
Edit2.Text:='';
Form2.ShowModal;
end
else
begin
//Edit1.Text:='';
Edit2.Text:='';
showmessage('密码不正确,请重新输入!');
end;
end
else
if radiobutton2.Checked=true then
begin
AdoQuery1.Close;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select * from 老师 where 用户名='''+Edit1.text+''' and 密码='''+Edit2.Text+''' ');
AdoQuery1.Open;
if ADOQuery1.RecordCount=1 then
begin
timer1.Enabled:=true;
Form3.Panel1.Visible:=true;
Form3.StatusBar1.Panels[1].Text:=Form3.StatusBar1.Panels[1].Text+Edit1.Text;
Form3.StatusBar1.Panels[4].Text:='0';
//Edit1.Text:='';
Edit2.Text:='';
Form3.ShowModal;
end
else
begin
//Edit1.Text:='';
Edit2.Text:='';
showmessage('密码不正确,请重新输入!');
end;
end
else
begin
AdoQuery1.Close;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select * from 学生 where 学号='''+Edit1.text+''' and 密码='''+Edit2.Text+''' ');
AdoQuery1.Open;
if ADOQuery1.RecordCount=1 then
begin
timer1.Enabled:=true;
Form4.Panel1.Visible:=true;
Form4.StatusBar1.Panels[1].Text:=Form4.StatusBar1.Panels[1].Text+Edit1.Text;
Form4.StatusBar1.Panels[4].Text:='0';
//Edit1.Text:='';
Edit2.Text:='';
Form4.ShowModal;
end
else
begin
//Edit1.Text:='';
Edit2.Text:='';
showmessage('密码不正确,请重新输入!');
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if RadioButton1.Checked=true then
begin
Form2.StatusBar1.Panels[4].Text:=inttostr(strtoint(Form2.StatusBar1.Panels[4].Text)+1);
Form2.StatusBar1.Panels[3].Text:=timetostr(now());
Form2.StatusBar1.Panels[2].Text:=formatdatetime('"今天是:"' + #13 + 'dddddd',date);
end
else
if RadioButton2.Checked=true then
begin
Form3.StatusBar1.Panels[4].Text:=inttostr(strtoint(Form3.StatusBar1.Panels[4].Text)+1);
Form3.StatusBar1.Panels[3].Text:=timetostr(now());
Form3.StatusBar1.Panels[2].Text:=formatdatetime('"今天是:"' + #13 + 'dddddd',date);
end
else
if RadioButton3.Checked=true then
begin
Form4.StatusBar1.Panels[4].Text:=inttostr(strtoint(Form4.StatusBar1.Panels[4].Text)+1);
Form4.StatusBar1.Panels[3].Text:=timetostr(now());
Form4.StatusBar1.Panels[2].Text:=formatdatetime('"今天是:"' + #13 + 'dddddd',date);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Edit1.SelStart := edit1.Tag ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -