DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: laidabin
今日帖子: 0
在线用户: 4
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 xuxugr (xuxugr) ★☆☆☆☆ -
普通会员
2018/5/26 0:07:55
标题:
ini操作 报错'string' and 'TWinControl' 浏览:590
加入我的收藏
楼主: var
   iniFile : TIniFile;
   idx : integer;
   ctrl : TControl;
begin

   iniFile := TIniFile.Create(ChangeFileExt(Application.ExeName,'.ini')) ;
   try
     for idx := 0 to -1 + Self.ComponentCount do
     begin
       if Components[idx] is TControl then
       begin
         ctrl := TControl(Components[idx]) ;
         iniFile.WriteInteger(ctrl.Name,'Top',ctrl.Top) ;
         iniFile.WriteInteger(ctrl.Name,'Left',ctrl.Left) ;
         iniFile.WriteInteger(ctrl.Name,'Width',ctrl.Width) ;
         iniFile.WriteInteger(ctrl.Name,'Height',ctrl.Height) ;

       end;
     end;
   finally
     FreeAndNil(iniFile) ;
   end;
end;


这个没有问题,但我想把生成的ini名称改为self.name,这样每个窗体都可以单独的
第二 iniFile.Writestring(ctrl.Name,'Height',ctrl.parent) ;
'string' and 'TWinControl' 这个怎么解决
----------------------------------------------
-
作者:
男 chscheese (chscheese) ★☆☆☆☆ -
盒子活跃会员
2018/5/26 1:21:00
1楼: iniFile.Writestring(ctrl.Name,'Height',intToStr(ctrl.parent.Height)) ;
----------------------------------------------
-
作者:
男 earthsbest (全能中间件) ▲▲▲▲△ -
普通会员
2018/5/26 10:32:55
2楼:  Section := ctrl.Owner.Name + '.' + ctrl.Name;
 iniFile.WriteInteger(Section, 'Top', ctrl.Top);
----------------------------------------------
Delphi4Linux Delphi三层/FireDAC 技术群:734515869 http://www.cnblogs.com/rtcmw
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行74.21875毫秒 RSS