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;     

原文地址:https://www.cnblogs.com/hnxxcxg/p/2940886.html