You can create your own methods to read and write the properties by writing your own methods to perform the streaming of the binary data to and from a stream, and register them with the VCL/RTL streaming system using DefineProperties and DefineBinaryProperty. There's an easy to follow example in the JEDI JVCL unit JVXSlider.pas:
// interface
type
TJvCustomSlider=class(TJvCustomControl)
private
procedure ReadUserImages(Stream: TStream);
procedure WriteUserImages(Stream: TStream);
...
protected
procedure DefineProperties(Filer: TFiler); override;
// implementation
procedure TJvCustomSlider.DefineProperties(Filer: TFiler);
function DoWrite: Boolean;
begin
if Assigned(Filer.Ancestor) then
Result := FUserImages <> TJvCustomSlider(Filer.Ancestor).FUserImages
else
Result := FUserImages <> [];
end;
begin
// @RemyLebeau points out that the next line is apparently a bug
// in the JVCL code, and that inherited DefineProperties should always
// be called regardless of the type of Filer. Commented it out, but
// didn't delete it because it *is* in the JVCL code I cited.
//if Filer is TReader then
inherited DefineProperties(Filer);
Filer.DefineBinaryProperty('UserImages', ReadUserImages, WriteUserImages, DoWrite);
end;
procedure TJvCustomSlider.ReadUserImages(Stream: TStream);
begin
Stream.ReadBuffer(FUserImages, SizeOf(FUserImages));
end;
procedure TJvCustomSlider.WriteUserImages(Stream: TStream);
begin
Stream.WriteBuffer(FUserImages, SizeOf(FUserImages));
end;
The Delphi streaming system will automatically call the appropriate methods for the defined property (in the example above, property UserImages) as needed to save to or read from the dfm file automatically; you never have the need to call them yourself.