USEGEAR

导航

cxGrid布局的保存和恢复

//恢复布局
IniFileName := ExtractFilePath(Application.ExeName) + 'Layout/' + Self.Name + '.ini';
if FileExists(IniFileName) then
Self.tvResult.RestoreFromIniFile(IniFileName) //从布局文件中恢复
else
begin
Self.tvResult.BeginUpdate;
for i := 0 to Self.tvResult.ItemCount - 1 do
Self.tvResult.Items[i].ApplyBestFit; //调整为最佳宽度
Self.tvResult.EndUpdate;
end;

//保存布局
IniFileName := ExtractFilePath(Application.ExeName) + 'Layout/' + Self.Name + '.ini';
if not DirectoryExists(ExtractFileDir(IniFileName)) then
CreateDir(ExtractFileDir(IniFileName));
Self.tvResult.StoreToIniFile(IniFileName); //保存为布局文件

 

https://www.cnblogs.com/hnxxcxg/archive/2010/05/24/2940716.html

posted on 2019-07-27 14:59  USEGEAR  阅读(677)  评论(0编辑  收藏  举报