DBGRIDEH格式保存/恢复

procedure TFrmColSelect.SaveGridLayOut;
var
  Ini: TIniFile;
begin
  if CheckBox1.Checked then
    Grid.SaveGridLayoutIni(ExtractFilePath(Application.ExeName) + '/Grid.ini',
      Owner.ClassName + '$' + Name, true)
  else
  begin
    Ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + '/Grid.ini');
    try
      Ini.EraseSection(Grid.Owner.ClassName + '$' + Grid.Name);
    finally
      Ini.Free;
    end;
  end;
end;


procedure RestoreGridLayOut(AGrid:TDBGridEh);
var
  RestoreParams:TDBGridEhRestoreParams;
begin
  RestoreParams:=[grpColIndexEh,grpColWidthsEh,grpSortMarkerEh,
    grpColVisibleEh,grpRowHeightEh];
  with AGrid do
    RestoreGridLayoutIni(ExtractFilePath(Application.ExeName) + '/Grid.ini',
      Owner.ClassName + '$' + Name,RestoreParams);
end;     

posted @ 2008-04-15 08:35  delphi中间件  阅读(457)  评论(0编辑  收藏  举报