⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datamanager.pas

📁 《管状换热器计算机辅助设计系统ExhCAD绘图系统(版本:1.01a Final)》为自由软件
💻 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 + -