📄 unit9.pas
字号:
unit Unit9;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, StdCtrls, ExtCtrls, Buttons;
type
TForm9 = class(TForm)
palUp: TPanel;
palLeftUp: TPanel;
imgGrayLeftUp: TImage;
imgColorLeftUp: TImage;
imgLeftUp: TImage;
imgSysIcon: TImage;
imgLeftUp1: TImage;
palRightUp: TPanel;
imgGrayRightUp: TImage;
imgRestoreButton: TImage;
imgMaxButton: TImage;
imgRightUp: TImage;
imgCloseButton: TImage;
imgMinButton: TImage;
imgSizeButton: TImage;
imgColorRightUp: TImage;
imgRightUp1: TImage;
palUpMid: TPanel;
imgColorMenubar: TImage;
imgGrayCaption: TImage;
imgGrayMenuBar: TImage;
imgCaption: TImage;
lbCaption: TLabel;
imgColorCaption: TImage;
CoolBarMenu: TCoolBar;
ToolBarMenu: TToolBar;
palDown: TPanel;
imgLeftDown: TImage;
imgRightDown: TImage;
imgDownMin: TImage;
palLeft: TPanel;
imgLeft: TImage;
palRight: TPanel;
imgRight: TImage;
palClient: TPanel;
Edit1: TEdit;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
SpeedButton1: TSpeedButton;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
OpenDialog1: TOpenDialog;
ProgressBar1: TProgressBar;
SaveDialog1: TSaveDialog;
Timer1: TTimer;
procedure imgCloseButtonClick(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
I: integer ;
{ Public declarations }
end;
var
Form9: TForm9;
implementation
{$R *.dfm}
procedure TForm9.imgCloseButtonClick(Sender: TObject);
begin
close ;
end;
procedure TForm9.BitBtn2Click(Sender: TObject);
begin
close ;
end;
procedure TForm9.SpeedButton1Click(Sender: TObject);
begin
if RadioButton1.Checked then
if SaveDialog1.Execute then
edit1.Text := SaveDialog1.FileName ;
if RadioButton2.Checked then
if OpenDialog1.Execute then
edit1.Text := OpenDialog1.FileName ;
end;
procedure TForm9.BitBtn1Click(Sender: TObject);
begin
if edit1.Text ='' then
begin
Application.MessageBox('请选择路径', '提示', MB_OK + MB_ICONWARNING);
exit ;
end;
i := 0 ;
Timer1.Enabled := true ;
ProgressBar1.Position := 0;
if RadioButton1.Checked then
begin
CopyFile(PChar(ExtractFilePath(Application.ExeName)+'\data\Sever.mdb'),pchar(edit1.text+'.mdb'),True) ;
end;
if RadioButton2.Checked then
begin
CopyFile(PChar(ExtractFilePath(Application.ExeName)+'\data\Sever.mdb'),pchar(edit1.text),True) ;
end;
end;
procedure TForm9.Timer1Timer(Sender: TObject);
begin
i := i+ 10 ;
ProgressBar1.Position := ProgressBar1.Position + 10 ;
if i >= 100 then
begin
ProgressBar1.Position := 0;
i := 0 ;
timer1.Enabled :=false;
if RadioButton1.Checked then
Application.MessageBox('备份成功', '提示', MB_OK + MB_ICONWARNING);
if RadioButton2.Checked then
Application.MessageBox('恢复成功', '提示', MB_OK + MB_ICONWARNING);
end;
end;
procedure TForm9.RadioButton1Click(Sender: TObject);
begin
lbCaption.Caption := '备份数据';
end;
procedure TForm9.RadioButton2Click(Sender: TObject);
begin
lbCaption.Caption := '恢复数据';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -