📄 definition.pas
字号:
unit definition;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls, Grids, DBGrids,
DBISAMCt;
type
TDefinitionForm = class(TForm)
ListBox1: TListBox;
RadioGroup1: TRadioGroup;
GroupBox1: TGroupBox;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
procedure BitBtn4Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DefinitionForm: TDefinitionForm;
F:string;
implementation
uses Frmain;
{$R *.dfm}
procedure TDefinitionForm.BitBtn4Click(Sender: TObject);
begin
close;
end;
procedure TDefinitionForm.RadioGroup1Click(Sender: TObject);
var
aPath:String;
begin
case RadioGroup1.ItemIndex of
0:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'Supply.txt';
ListBox1.Items.LoadFromFile(F);
end;
1:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'Buy.txt';
ListBox1.Items.LoadFromFile(F);
end;
2:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'KB.txt';
ListBox1.Items.LoadFromFile(F);
end;
3:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'FH.txt';
ListBox1.Items.LoadFromFile(F);
end;
4:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'HH.txt';
ListBox1.Items.LoadFromFile(F);
end;
5:
begin
aPath:=ExtractFilePath(Application.ExeName)+'txt\';
ListBox1.clear;
F:=aPath+'SK.txt';
ListBox1.Items.LoadFromFile(F);
end;
end;
end;
procedure TDefinitionForm.BitBtn1Click(Sender: TObject);
begin
if Edit1.Text=''then
Application.messagebox('请输入要新增的条目!','错误',MB_Ok+Mb_iconerror)
else
begin
ListBox1.Items.Add(Edit1.Text);
ListBox1.Items.SaveToFile(F);
Edit1.Text:='';
end;
end;
procedure TDefinitionForm.BitBtn3Click(Sender: TObject);
begin
if RadioGroup1.ItemIndex = -1 then
Application.messagebox('请选择条目进行操作!','错误',MB_Ok+Mb_iconerror)
else
begin
Application.messagebox('请选定要删除的条目!','提示',Mb_YesNo+Mb_IconQuestion);
ListBox1.Items.Delete(listbox1.itemindex);
ListBox1.Items.SaveToFile(F);
end;
end;
procedure TDefinitionForm.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
BitBtn1.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -