//恢复布局 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); //保存为布局文件