📄 unitdbbuckup.pas
字号:
unit UnitDbBuckup;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, Gauges, ExtCtrls, StdCtrls, jpeg;
type
TFrameDbBuckup = class(TFrame)
Image1: TImage;
GroupBox1: TGroupBox;
Image2: TImage;
Image3: TImage;
SaveDialog1: TSaveDialog;
Gauge1: TGauge;
OpenDialog1: TOpenDialog;
procedure Image2Click(Sender: TObject);
procedure Image3Click(Sender: TObject);
procedure Show();
private
{ Private declarations }
LangSysmsgTitle: string;
LangRecover: string;
LangSuccessBackup: string;
LangFailBackup: string;
LangBesure: string;
LangSuccessRestore: string;
LangFailRestore: string;
public
{ Public declarations }
end;
implementation
uses UnitLogin;
{$R *.dfm}
procedure TFrameDbBuckup.Image2Click(Sender: TObject);
var
i: integer;
begin
try
if not savedialog1.Execute then exit;
if FileExists(savedialog1.FileName+'.mdb') then
begin
if Messagebox(handle,pChar(LangRecover),pChar(LangSysmsgTitle),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,pChar(LangSuccessBackup),pChar(LangSysmsgTitle),mb_iconinformation+mb_ok);
end;
except
Messagebox(handle,pChar(LangFailBackup),pChar(LangSysmsgTitle),mb_iconwarning+mb_ok);
end;
end;
procedure TFrameDbBuckup.Image3Click(Sender: TObject);
var
i: integer;
begin
try
if not opendialog1.Execute then exit;
if Messagebox(handle,pChar(LangBesure),pChar(LangSysmsgTitle),mb_iconquestion+mb_yesno)=IDNo then Exit;
for i:=Gauge1.MinValue to Gauge1.MaxValue do
Gauge1.Progress := i;
// CopyFile(PChar(OpenDialog1.FileName+'.mdb'),PChar(Form1.DataFile),True);
Messagebox(handle,pChar(LangSuccessRestore),pChar(LangSysmsgTitle),mb_iconinformation+mb_ok);
except
Messagebox(handle,pChar(LangFailRestore),pChar(LangSysmsgTitle),mb_iconwarning+mb_ok);
end;
end;
procedure TFrameDbBuckup.Show();
begin
if (Lang='cn') then {中文界面}
begin
GroupBox1.Caption := '备份(还原)进度:';
Image2.Picture.LoadFromFile(ExeRootPath+'/images/btn_buckup.jpg');
Image3.Picture.LoadFromFile(ExeRootPath+'/images/btn_restore.jpg');
LangSysmsgTitle := '系统提示';
LangRecover := '存在数据库重名,是否覆盖?';
LangSuccessBackup := '数据库备份成功!';
LangFailBackup := '警告:数据库备份失败!';
LangBesure := '警告:现有数据有可能丢失,确定还原?';
LangSuccessRestore := '数据库还原成功!';
LangFailRestore := '警告:数据库还原失败!';
end
else {英文界面}
begin
GroupBox1.Caption := 'Gauge:';
Image2.Picture.LoadFromFile(ExeRootPath+'/images/btn_buckup_en.jpg');
Image3.Picture.LoadFromFile(ExeRootPath+'/images/btn_restore_en.jpg');
LangSysmsgTitle := 'System Message';
LangRecover := 'File must be exsited, cover it?';
LangSuccessBackup := 'Backup success!';
LangFailBackup := 'Warning: backup failed!';
LangBesure := 'Warning: the operate must lead to lost data, continue restore?';
LangSuccessRestore := 'Restore success!';
LangFailRestore := 'Warning: Restore failed!';
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -