delphi restore window

1. Pattern restoration
procedure TFrmStyleProp.btnNewClick(Sender: TObject);
//declare
var
iniFile : TIniFile;
idx : integer;
ctrl : TControl;
begin
//pattern restoration
iniFile := TIniFile.Create(ChangeFileExt(Application.ExeName,'- posi.ini')) ;
try
for idx := 0 to -1 + Self.ComponentCount do
begin
if Components[idx] is TRzSizePanel then
begin
ctrl := TControl(Components[idx]) ;
//This method deletes the INI file an entire paragraph specified.
iniFile.EraseSection(ClassName + '.' + ctrl.Name);
end;
end;
B_Retrun_posi := True;
finally
FreeAndNil(iniFile) ;
end;
ShowMessage('The format is restored, and it will take effect after re-entering the window!');
end;
2.var
........
B_Retrun_posi:Boolean; //BN0158 declare variable

3.procedure TFrmStyleProp.FormClose(Sender: TObject; var Action: TCloseAction);

begin
if not B_Retrun_posi then
WriteControlPlacement;
Action := caFree;
end;

 


4.procedure TFrmStyleProp.FormCreate(Sender: TObject);
。。。。

B_Retrun_posi := False;

      14:38:58   2018-04-16

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324466629&siteId=291194637