I had the need to provide a report that looked like a
form with box around text area. ie. a combination of a
box shape and text label.
Basic solution I wrote and submit for your
consideration was for a new property "DrawFrame". (I
set this at runtime but would be better to see
DrawFrame attribute in designer.) All we do then is
override the DoPrint method.
Unit: rpprintitem.pas
TRpGenTextComponent=class\(TRpCommonPosComponent\)
...
FDrawFrame: Boolean;
...
protected
...
procedure DoPrint\(adriver:IRpPrintDriver;
posx,aposy,newwidth,newheight:Integer;
metafile:TRpMetafileReport;
MaxExtent:TPoint;var PartialPrint:Boolean\);override;
...
published
property DrawFrame : Boolean read FDrawFrame write
FDrawFrame;
...
procedure TRpGenTextComponent.DoPrint
\(adriver: IRpPrintDriver;
aposx, aposy, newwidth, newheight: Integer;
metafile: TRpMetafileReport;
MaxExtent: TPoint;
var PartialPrint: Boolean\);
begin
inherited DoPrint\(adriver, aposx, aposy, newwidth,
newheight, metafile, MaxExtent, PartialPrint\);
if FDrawFrame then
metafile.Pages\[metafile.CurrentPage\].NewDrawObject\(
aposy, aposx - 40, PrintWidth + 80, PrintHeight,
integer\(rpsRectangle\), 0\{BrushStyle\},
$FFFFFF\{FontColor\}, 0\{PenStyle\}, 10\{PenWidth\},
0\{PenColor\}\);
// NB if we owned a TrpShape, then we'd probably
utilize it's properties: BrushStyle, BrushColor, etc.
end;
Submitted by:
Ian Krigsman
ian@discoverysystems.com.au