在一个窗体上的Panel上的,动态地创建了一些控件, 将所有控件属性值保存下来当下次运行程序的时候程序会根把上次保存的文件,自动加载panel的属性和上面的控件
解决方案 »
- Crc算法 ssp delphi 算法
- 如何自动关闭ShowMessage,MessageBox,MessageDlg等产生的消息框
- 关于建立ado之后的信息显示问题!!
- 如何在Delphi5.0中 调用Sybase存储过程 高手赐教!100分
- 如何在DLL中为窗体创建控件并且为该控件增加事件和代码,以BUTTON为例。
- TIdhttp.get方法打开google搜索引擎发生错误?
- 关于制作安装程序
- 关于DBGRID的使用?
- 谁有Delphi 5企业级解决方案及应用剖析一书的源代码?
- 在Delphi5中如何通过句柄来判断它是否是TForm这个类?
- 用SendMessage()对Memo如lines.add
- 攒分,散分;BS问了问题就销声匿迹的人.
这个是国标做法。
var
rTemp: TReader;
strDfm: string;
cmpTemp: TComponent;
msString, msBinary: TMemoryStream; msString := TMemoryStream.Create;
msBinary := TMemoryStream.Create;
try
//load the DFM file as a text file
with TStringList.Create do
try
LoadFromFile(‘文件名’);
//to judge if the form in inherited from others
Text := StringReplace(Text,'inherited','object',[rfReplaceAll]);
SaveToStream(msString);
finally
Free;
end;
//msString.LoadFromFile(strForm);
msString.Write(strDfm[1], Length(strDfm));
msString.Position := 0;
ObjectTextToBinary(msString, msBinary); msBinary.Position := 0;
rTemp := TReader.Create(msBinary, 4096);
rTemp.Parent := nil;
rTemp.Owner := nil; //set the method to the TReader
rTemp.OnSetName := setNameEvent;
rTemp.OnCreateComponent := CreateComponentEvent;
rTemp.OnFindMethod := FindMethodEvent;
//end //create the preview form
cmpTemp := rTemp.ReadRootComponent(TForm.Create(nil));
TForm(cmpTemp).Show;
finally
FreeAndNil(msString);
FreeAndNil(msBinary);
end;
end;你可以用一个dfm文件试试~