📄 userlist.pas
字号:
unit userlist;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TFormuserlist = class(TForm)
ListBox1: TListBox;
Bevel1: TBevel;
add: TButton;
modify: TButton;
delete: TButton;
Button4: TButton;
Image2: TImage;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure addClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button4Click(Sender: TObject);
procedure modifyClick(Sender: TObject);
procedure deleteClick(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formuserlist: TFormuserlist;
// insert:boolean;
indexstr:string;
implementation
uses datamol,main, security;
{$R *.DFM}
procedure TFormuserlist.FormCreate(Sender: TObject);
var
no,name,hjstr:string;
begin
datamod.tblpassword.Open;
listbox1.Items.Clear;
if datamod.Tblpassword.RecordCount>0 then
begin
datamod.Tblpassword.First;
while not datamod.Tblpassword.Eof do
begin
no:=datamod.Tblpasswordno.AsString;
name:=datamod.Tblpasswordname.AsString;
hjstr:=' '+no+' '+name;
Listbox1.Items.AddObject(hjstr,Image1.Picture.Bitmap);
datamod.Tblpassword.Next;
end;
end else
Listbox1.Items.AddObject('没有设定操作员',Image2.Picture.bitmap);
end;
procedure TFormuserlist.addClick(Sender: TObject);
begin
insert:=true;
formsecurity:=TFormsecurity.Create(application);
formsecurity.show;
// formuserlist.visible:=false;
// formsecurity.free;
end;
procedure TFormuserlist.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
formuserlist:=nil;
action:=cafree;
formmain.outlook1.visible:=true;
datamod.tblpassword.Close;
end;
procedure TFormuserlist.Button4Click(Sender: TObject);
begin
formmain.outlook1.visible:=true;
close;
end;
procedure TFormuserlist.modifyClick(Sender: TObject);
begin
if listbox1.itemindex<>-1 then
begin
insert:=false;
indexstr:=Listbox1.Items[Listbox1.ItemIndex];
indexstr:=Copy(indexstr,2,10);
Formsecurity:=TFormsecurity.Create(Application);
Formsecurity.Show;
end;
end;
procedure TFormuserlist.deleteClick(Sender: TObject);
var
gh,mc,hjstr,delbh,delmc:string;
begin
delbh:=Listbox1.Items[Listbox1.ItemIndex];
Delbh:=Copy(Delbh,2,10);
datamod.Tblpassword.Locate('no',delbh,[]);
delmc:=datamod.Tblpasswordname.Value;
if Application.MessageBox(PChar('你确定要删除《'+delmc+'》这个用户?'),'删除',
mb_yesno+mb_iconquestion)=idyes then
begin
datamod.Tblpassword.Delete;
listbox1.Items.Clear;
datamod.tblpassword.close;
datamod.tblpassword.open;
if datamod.Tblpassword.RecordCount>0 then
begin
datamod.Tblpassword.First;
while not datamod.Tblpassword.Eof do
begin
gh:=datamod.Tblpasswordno.AsString;
mc:=datamod.Tblpasswordname.AsString;
hjstr:=' '+gh+' '+mc;
Listbox1.Items.AddObject(hjstr,Image1.Picture.Bitmap);
datamod.Tblpassword.Next;
end;
end else
Listbox1.Items.AddObject('没有设定操作员',Image2.Picture.bitmap);
end;
end;
procedure TFormuserlist.ListBox1DblClick(Sender: TObject);
begin
if listbox1.itemindex<>-1 then
begin
insert:=false;
indexstr:=Listbox1.Items[Listbox1.ItemIndex];
indexstr:=Copy(indexstr,2,10);
Formsecurity:=TFormsecurity.Create(Application);
Formsecurity.Show;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -