unit3.~pas

来自「如果您在试用或使用过程中认为软件需修改」· ~PAS 代码 · 共 61 行

~PAS
61
字号
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls,StdCtrls, ExtCtrls, Gauges;

  


type
  TForm2 = class(TForm)
    GroupBox1: TGroupBox;
    Gauge1: TGauge;
    Image2: TImage;
    Image3: TImage;
    SaveDialog1: TSaveDialog;
    OpenDialog1: TOpenDialog;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  i: integer;
  DataFile: String;
begin
    DataFile := GetCurrentDir+'\Data\XQ_Data.MDF';
   try
    if not savedialog1.Execute then exit;
    if FileExists(savedialog1.FileName+'.mdf') then
    begin
      if Messagebox(handle,'存在数据库重名,是否覆盖?','存盘选项',mb_iconquestion+mb_yesno)=IDNo then Exit;
    end
    else
    begin
      for i:=Gauge1.MinValue to Gauge1.MaxValue do
        Gauge1.Progress := i;
      CopyFile(PChar(DataFile),PChar(SaveDialog1.FileName+'.mdb'),True);
      Messagebox(handle,'数据库备份成功!','备份数据',mb_iconinformation+mb_ok);
    end;
  except
    Messagebox(handle,'警告:数据库备份失败!','存盘错误',mb_iconwarning+mb_ok);
  end;
end;

end.

⌨️ 快捷键说明

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