I am using ComponentToString function shown in Delphi 7 help file (see code
reproduced below) to serialize a TFrame to a text file, actually to recreate
the DFM file from a loaded form. It works nice except that non visual
component loose their top and left properties.

The question is: how to make top and left properties serialized when using
ComponentToString function ?

Any help appreciated.

function ComponentToString(Component: TComponent): String;
var
    BinStream : TMemoryStream;
    StrStream : TStringStream;
begin
    BinStream := TMemoryStream.Create;
    try
        StrStream := TStringStream.Create('');
        try
            BinStream.WriteComponent(Component);
            BinStream.Seek(0, soFromBeginning);
            ObjectBinaryToText(BinStream, StrStream);
            Result:= StrStream.DataString;
        finally
            StrStream.Free;
        end;
    finally
        BinStream.Free
    end;
end;

--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to