这是控件保存成文件与返过程,不过你是要把EDIT的内容TEXT,还是EDIT的HEIGHT等属性保存进来,也没说得怎么样清楚,真是的。说清楚点。<br>precudre ComponentToFile(Component: TComponent,filename:String);<br>var<br> BinStream:TMemoryStream;<br>begin<br> try<br> BinStream := TMemoryStream.Create;<br> BinStream.WriteComponent(Component);<br> BinStream.SaveToFile(filename);<br> finally<br> BinStream.Free<br> end;<br>end;<br><br>function FileToComponent(Value: String;var Com:TComponent);<br>var<br> StrStream:TStringStream;<br> BinStream: TMemoryStream;<br> tempcom:TComponent <br>i:integer;<br> tc:TClass;<br>begin<br> tc:=tc.classtype;<br> tempform:=tc.create(nil);<br> for i=0 to tempcom.componentcount-1 do<br> tempform.Components.Free;<br> BinStream := TMemoryStream.Create;<br> try<br> binStream.loadfrom(value);<br> BinStream.Seek(0, soFromBeginning);<br> com :=BinStream.ReadComponent(tempform);<br> finally<br> BinStream.Free;<br> end;<br>end;