//存储Grid格式ini
function SaveGridIni(ADBGridEhNameStr: string;ADBGridEh:TDBGridEh): Boolean;
var
  IniFileNameStr:string;
begin
    IniFileNameStr := ExtractFileDir(ParamStr(0)) + '\' + 'DBGirdConfig.ini';
    ADBGridEh.SaveGridLayoutIni(IniFileNameStr,ADBGridEhNameStr,False);
end;

//加载读取Grid格式ini
function RestoreGridIni(ADBGridEhNameStr: string;ADBGridEh:TDBGridEh): Boolean;
var
  IniFileNameStr:string;
  RestoreParams: TDBGridEhRestoreParams;
begin
    IniFileNameStr := ExtractFileDir(ParamStr(0)) + '\' + 'DBGirdConfig.ini';
    ADBGridEh.RestoreGridLayoutIni(IniFileNameStr,ADBGridEhNameStr,RestoreParams);
end;

 

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBGridEh1.SaveGridLayoutIni('C:\DBGridEh.ini',DBGridEh1.ClassName,True);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  MyRestoreParams :TDBGridEhRestoreParams;
begin
  MyRestoreParams :=[grpColIndexEh,grpColWidthsEh,grpSortMarkerEh,grpColVisibleEh,grpRowHeightEh];
DBGridEh1.RestoreGridLayoutIni('C:\DBGridEh.ini',DBGridEh1.ClassName,MyRestoreParams); end;

 

posted on 2013-04-07 22:22  del88  阅读(15)  评论(0编辑  收藏  举报