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

📄 unitpropertiesset.pas

📁 一个多元非线性回归分析源码以及其中的公式列表
💻 PAS
字号:
unit UnitPropertiesSet;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, ValEdit, StdCtrls, Buttons;

type
  TfrmPropertiesSet = class(TForm)
    ValueListEditorConfig: TValueListEditor;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    OpenDataDialog: TOpenDialog;
    SaveDataDialog: TSaveDialog;
    ValueListEditorConfigTemp: TValueListEditor;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure ValueListEditorConfigKeyPress(Sender: TObject;
      var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmPropertiesSet: TfrmPropertiesSet;

implementation

uses UnitAuto;

{$R *.dfm}

procedure TfrmPropertiesSet.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=caFree;
end;

procedure TfrmPropertiesSet.BitBtn4Click(Sender: TObject);
begin
  self.Close;
end;

procedure TfrmPropertiesSet.BitBtn1Click(Sender: TObject);
var strFName   :string;
begin
  try
    self.SaveDataDialog.FileName:='';
    if self.SaveDataDialog.Execute then
    begin
        strFName:=SaveDataDialog.FileName;
        if SaveDataDialog.Filterindex=1 then
        begin
            if UpperCase(copy(strFName,length(strFName)-3,4))='.TXT' then
                strFName:=strFName
            else
                strFName:=strFName+'.TXT';
        end
        else if SaveDataDialog.Filterindex=2 then
        begin
            strFName:=strFName;
        end;
        if FileExists(strFName) then
        begin
            if not ( application.MessageBox(pchar('文件 "'+strFName+'" 已经存在,要覆盖吗?'),'警告:',MB_OKCANCEL+MB_ICONWARNING)=IDOK )	 then
                exit; 
          DeleteFile(strFName);
        end;
        self.ValueListEditorConfig.Strings.SaveToFile(strFName);
    end;
  except
    application.MessageBox(Pchar('保存数据时出现错误。'),'出错:',MB_ICONERROR);
  end;
end;

procedure TfrmPropertiesSet.BitBtn2Click(Sender: TObject);
var
  i   :integer;
  str :string;
begin
  try
    self.OpenDataDialog.FileName:='';
    if self.OpenDataDialog.Execute then
    begin
        if self.OpenDataDialog.FileName<>'' then
        begin
            if FileExists(self.OpenDataDialog.FileName)  then
            begin
                ValueListEditorConfigTemp.Strings.LoadFromFile(self.OpenDataDialog.FileName);
                for i:=1 to  ValueListEditorConfig.RowCount-1 do
                begin
                  str:=ValueListEditorConfigTemp.Values[ValueListEditorConfig.Cells[0,i]];
                  if str<>'' then
                    ValueListEditorConfig.Cells[1,i]:=str;
                end;
                ValueListEditorConfigTemp.Strings.Text:='';
            end
            else
                application.MessageBox(Pchar('文件没有找到!'),'警告:',MB_ICONWARNING);
        end;
    end;
  except
    application.MessageBox(Pchar('打开文件时出现错误。'),'出错:',MB_ICONERROR);
    self.ValueListEditorConfig.Strings.Text:=frmMain.ValueListEditorConfig.Strings.Text;
  end;
end;

procedure TfrmPropertiesSet.FormCreate(Sender: TObject);
begin
  self.ValueListEditorConfig.Strings.Text:=frmMain.ValueListEditorConfig.Strings.Text;
end;

procedure TfrmPropertiesSet.BitBtn3Click(Sender: TObject);
begin
  frmMain.ValueListEditorConfig.Strings.Text:=self.ValueListEditorConfig.Strings.Text;
  self.Close;
end;

procedure TfrmPropertiesSet.ValueListEditorConfigKeyPress(Sender: TObject;
  var Key: Char);
begin
    Key:=upcase(Key);
    //showmessage(inttostr(byte(key)));
    case Key of
        '0','1','2','3','4','5','6','7','8','9': Key:=Key;
        'E','.','-','+': Key:=Key;
        #8,#9,#13: Key:=Key;
        else Key:=#0;
    end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -