?? datamanager.pas
字號:
unit DataManager;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, Tabs, ComCtrls, TabNotBk, Grids,Declare,IniFiles,DataSet;
type
TDataManagerForm = class(TForm)
DataManagerMainMenu: TMainMenu;
N1: TMenuItem;
Save: TMenuItem;
eXit: TMenuItem;
Open: TMenuItem;
DataManagerPageControl: TPageControl;
AirPhyTabSheet: TTabSheet;
FumePhyTabSheet: TTabSheet;
PipLenTabSheet: TTabSheet;
PipRowTabSheet: TTabSheet;
PipLenStringGrid: TStringGrid;
AirPhyStringGrid: TStringGrid;
FumePhyStringGrid: TStringGrid;
PipRowStringGrid: TStringGrid;
DataManagerOpenDialog: TOpenDialog;
DataManagerSaveDialog: TSaveDialog;
DataManagerPopupMenu: TPopupMenu;
Append: TMenuItem;
About: TMenuItem;
deLete1: TMenuItem;
N2: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure eXitClick(Sender: TObject);
procedure OpenClick(Sender: TObject);
procedure SaveClick(Sender: TObject);
procedure AppendClick(Sender: TObject);
procedure AboutClick(Sender: TObject);
procedure deLete1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataManagerForm: TDataManagerForm;
AirPhyNum:integer;
FumePhyNum :integer;
PipLenNum :integer;
PipRowNum: integer;
procedure ReadIniFile;
implementation
{$R *.dfm}
procedure TDataManagerForm.FormCreate(Sender: TObject);
begin
ReadIniFile;
InitialDataManager;
end;
procedure TDataManagerForm.eXitClick(Sender: TObject);
begin
Close;
end;
procedure TDataManagerForm.OpenClick(Sender: TObject);
begin
DataManagerOpenDialog.Title:='打開數據文件';
DataManagerOpenDialog.Filter:='打開數據文件(*.dat)|*.dat';
DataManagerOpenDialog.FileName:='';
if airphytabsheet.Visible then
if DataManagerOpenDialog.Execute then
with DataManagerOpenDialog do
begin
ReadAirPhysicsFile(FileName);
end;
if fumephytabsheet.Visible then
if DataManagerOpenDialog.Execute then
with DataManagerOpenDialog do
begin
ReadFumePhysicsFile(FileName);
end;
if piplentabsheet.Visible then
if DataManagerOpenDialog.Execute then
with DataManagerOpenDialog do
begin
ReadpiplenFile(FileName);
end;
if piprowtabsheet.Visible then
if DataManagerOpenDialog.Execute then
with DataManagerOpenDialog do
begin
ReadpiprowFile(FileName);
end;
end;
procedure TDataManagerForm.SaveClick(Sender: TObject);
begin
DataManagersaveDialog.Title:='保存數據文件';
DataManagersaveDialog.Filter:='保存數據文件(*.dat)|*.dat';
DataManagersaveDialog.FileName:='';
if airphytabsheet.Visible then
if DataManagersaveDialog.Execute then
with DataManagersaveDialog do
begin
writeAirPhysicsFile(FileName);
end;
if fumephytabsheet.Visible then
if DataManagersaveDialog.Execute then
with DataManagersaveDialog do
begin
writeFumePhysicsFile(FileName);
end;
if piplentabsheet.Visible then
if DataManagersaveDialog.Execute then
with DataManagersaveDialog do
begin
writepiplenFile(FileName);
end;
if piprowtabsheet.Visible then
if DataManagersaveDialog.Execute then
with DataManagersaveDialog do
begin
writepiprowFile(FileName);
end;
end;
procedure ReadIniFile;
var IniFile:TIniFile;
begin
IniFile := TIniFile.Create(ExtractFilePath(Application.exename)+'/datamanager.ini');
AirPhyNum := Inifile.ReadInteger('Data Manager', 'AirPhy', 25);
FumePhyNum := Inifile.ReadInteger('Data Manager', 'FumePhy', 12);
PipLenNum := Inifile.ReadInteger('Data Manager', 'PipLen', 14);
PipRowNum := Inifile.ReadInteger('Data Manager', 'PipRow', 11);
IniFile.Free;
end;
procedure WriteIniFile;
var IniFile:TIniFile;
begin
IniFile := TIniFile.Create(ExtractFilePath(Application.exename)+'/datamanager.ini');
Inifile.WriteInteger('Data Manager', 'AirPhy', AirPhyNum );
Inifile.WriteInteger('Data Manager', 'FumePhy', FumePhyNum);
Inifile.WriteInteger('Data Manager', 'PipLen', PipLenNum);
Inifile.WriteInteger('Data Manager', 'PipRow', PipRowNum);
IniFile.Free;
end;
procedure TDataManagerForm.AppendClick(Sender: TObject);
begin
if airphytabsheet.Visible then
begin
airphynum:=airphynum+1;
airphystringgrid.Cells[0,airphynum-1]:=inttostr(airphynum-1);
end;
if fumephytabsheet.Visible then
begin
fumephynum:=fumephynum+1;
fumephystringgrid.Cells[0,fumephynum-1]:=inttostr(fumephynum-1);
end;
if piplentabsheet.Visible then
begin
piplennum:=piplennum+1;
piplenstringgrid.Cells[0,piplennum-1]:=inttostr(piplennum-1);
end;
if piprowtabsheet.Visible then
begin
piprownum:=piprownum+1;
piprowstringgrid.Cells[0,piprownum-1]:=inttostr(piprownum-1);
end;
InitialDataManager;
WriteIniFile;
end;
procedure TDataManagerForm.AboutClick(Sender: TObject);
begin
MessageDlg('簡易ExhCAD繪圖數據管理系統'+chr(13)+'版本:1.01a'+chr(13)+'程序設計:endlessfree', mtInformation,
[mbOk], 0);
end;
procedure TDataManagerForm.deLete1Click(Sender: TObject);
begin
if airphytabsheet.Visible then
begin
airphynum:=airphynum-1;
airphystringgrid.Cells[0,airphynum-1]:=inttostr(airphynum-1);
end;
if fumephytabsheet.Visible then
begin
fumephynum:=fumephynum-1;
fumephystringgrid.Cells[0,fumephynum-1]:=inttostr(fumephynum-1);
end;
if piplentabsheet.Visible then
begin
piplennum:=piplennum-1;
piplenstringgrid.Cells[0,piplennum-1]:=inttostr(piplennum-1);
end;
if piprowtabsheet.Visible then
begin
piprownum:=piprownum-1;
piprowstringgrid.Cells[0,piprownum-1]:=inttostr(piprownum-1);
end;
InitialDataManager;
WriteIniFile;
end;
procedure TDataManagerForm.N2Click(Sender: TObject);
var pop:TDataSetForm;
begin
pop:=TDataSetForm.Create(Self);
pop.Show;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -