Les en komponent som string

Hvordan konvertere enhver komponent til en string.function ComponentToString (Komponent: TComponent): string; Var BinStream: TMemoryStream; StrStream: TStringStream, begynner BinStream: = TMemoryStream.Create; prøve StrStream: = TStringStream.Create (resultater); prøve BinStream.WriteComponent (komponent); BinStream.Seek (0, soFromBeginning); ObjectBinaryToText (BinStream, StrStream); StrStream.Seek (0, soFromBeginning); Resultat: = StrStream.DataString; endelig StrStream.Free; slutt; endelig BinStream.Free slutten, slutten;



Previous:
Next Page: