可以东南大学Delphi在程序运行时设置的属性第1个回答:ysjqrmpv2010-05-31TA获得超过

第1个回答:

ysjqrmpv2010-05-31TA获得超过115个赞关注用ini文件把在运行程序时设置的属性保存在ini文件里在formOncreate的事件中读取ini文件;首先要在文件夹下新建一个名为MyIni文件在窗体中添加一个Button1,和ColorDialog1..Usesinifiles;//初始化配置proce**reTForm1.FormCreate(Sender:TObject);varmyini:TIniFile;beginifFileExists(ExtractFilePath(Application.ExeName)+'myini.ini')thenbeginmyini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');self.Color:=myini.ReadInteger('config','fcolor',0);myini.Free;end;end;//设置窗体颜色proce**reTForm1.Button1Click(Sender:TObject);varmyini:TIniFile;beginifFileExists(ExtractFilePath(Application.ExeName)+'myini.ini')thenbeginmyini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');ifColorDialog1.Executethenbeginmyini.WriteInteger('Config','FColor',ColorDialog1.Color);self.Color:=myini.ReadInteger('config','fcolor',0);end;myini.Free;endelseShowMessage('MyIni文件不存在!');end;