F
fstao
Unregistered / Unconfirmed
GUEST, unregistred user!
由于ReportBuilder5.51没有画斜线的功能,本人想做一个能画斜线的组件。
源程序如下:
unit ppMyLine;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ppComm, ppRelatv, ppProd, ppClass;
type
TLines = ( None,TopBottom,BottomTop ) ;
TppMyLine = class(TppCustomReport)
private
FLineType:TLines ;
procedure SetFLineType(Value:TLines) ;
protected
procedure ppPrint(OfsX, OfsY : integer); override; // [Error] Method 'ppPrint'
// not found in base class
procedure Paint ;Override ;//[Error] Method 'Paint' not found in base class
public
{ Public declarations }
published
property LineType:TLines Read FLineType Write SetFLineType ;
end;
procedure Register;
implementation
procedure TppMyLine.SetFLineType(Value:TLines);
begin
if Value<>FLineType then
begin
FLineType:=Value ;
Invalidate ;
end ;
end ;
procedure TppMyLine.Paint ;
begin
case LineType of
BottomTop:
begin
Canvas.MoveTo(0,Height) ;
Canvas.LineTo(width,0 ) ;
end ;
TopBottom:
begin
Canvas.MoveTo(0,0) ;
Canvas.LineTo(width,Height ) ;
end ;
None:
begin
Height := Parent.Height ;
Top:=0 ;
Width:=4 ;
Shape:=qrsVertLine ;
Inherited Paint ;
end ;
end ;
end ;
procedure TppMyLine.ppPrint(OfsX,OfsY : Integer);
begin
with QRPrinter do
begin
case LineType of
BottomTop:
begin
Canvas.MoveTo(XPos(OfsX + Size.Left), YPos(OfsY + Size.Top)+Height) ;
Canvas.LineTo(XPos(OfsX + Size.Left)+width,YPos(OfsY + Size.Top) ) ;
end ;
TopBottom:
begin
Canvas.MoveTo(XPos(OfsX + Size.Left), YPos(OfsY + Size.Top)) ;
Canvas.LineTo(XPos(OfsX + Size.Left)+Width,YPos(OfsY + Size.Top)+Height ) ;
end ;
None:
Inherited ppPrint(OfsX,OfsY ) ;
end ;
end ;
end;
procedure Register;
begin
RegisterComponents('RBuilder', [TppMyLine]);
end;
end.
编译时出现错误,错误如上提示,请问如何改上面的代码?以上例子是根据QuickReport画斜线
而改动的。或者谁有这个画斜线的组件(for RBuilder5.51)的单独源程序e_mail给我。
源程序如下:
unit ppMyLine;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ppComm, ppRelatv, ppProd, ppClass;
type
TLines = ( None,TopBottom,BottomTop ) ;
TppMyLine = class(TppCustomReport)
private
FLineType:TLines ;
procedure SetFLineType(Value:TLines) ;
protected
procedure ppPrint(OfsX, OfsY : integer); override; // [Error] Method 'ppPrint'
// not found in base class
procedure Paint ;Override ;//[Error] Method 'Paint' not found in base class
public
{ Public declarations }
published
property LineType:TLines Read FLineType Write SetFLineType ;
end;
procedure Register;
implementation
procedure TppMyLine.SetFLineType(Value:TLines);
begin
if Value<>FLineType then
begin
FLineType:=Value ;
Invalidate ;
end ;
end ;
procedure TppMyLine.Paint ;
begin
case LineType of
BottomTop:
begin
Canvas.MoveTo(0,Height) ;
Canvas.LineTo(width,0 ) ;
end ;
TopBottom:
begin
Canvas.MoveTo(0,0) ;
Canvas.LineTo(width,Height ) ;
end ;
None:
begin
Height := Parent.Height ;
Top:=0 ;
Width:=4 ;
Shape:=qrsVertLine ;
Inherited Paint ;
end ;
end ;
end ;
procedure TppMyLine.ppPrint(OfsX,OfsY : Integer);
begin
with QRPrinter do
begin
case LineType of
BottomTop:
begin
Canvas.MoveTo(XPos(OfsX + Size.Left), YPos(OfsY + Size.Top)+Height) ;
Canvas.LineTo(XPos(OfsX + Size.Left)+width,YPos(OfsY + Size.Top) ) ;
end ;
TopBottom:
begin
Canvas.MoveTo(XPos(OfsX + Size.Left), YPos(OfsY + Size.Top)) ;
Canvas.LineTo(XPos(OfsX + Size.Left)+Width,YPos(OfsY + Size.Top)+Height ) ;
end ;
None:
Inherited ppPrint(OfsX,OfsY ) ;
end ;
end ;
end;
procedure Register;
begin
RegisterComponents('RBuilder', [TppMyLine]);
end;
end.
编译时出现错误,错误如上提示,请问如何改上面的代码?以上例子是根据QuickReport画斜线
而改动的。或者谁有这个画斜线的组件(for RBuilder5.51)的单独源程序e_mail给我。