用Delphi制作中国式报表
添加时间: 2006-2-25 7:28:29 作者: Delphi教程 阅读次数:99 来源: http://www.d9soft.com
|
Shape:=qrsVertLine Inherited Paint end end end |
步骤6.重载Print方法。
|
procedure TMyQRShape.Print(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 Print(OfsX,OfsY ) end end end; |
步骤7.保存并安装TMyQRShape控件。
本控件在Delphi40下调试、安装,并成功地应用于某数据库管理系统的开发中。该控件的完整代码如下:
源程序:
|
unit MyQRShape; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, QuickRpt, Qrctrls; type TLines = ( None,TopBottom,BottomTop ) TMyQRShape = class(TQRShape) private FLineType:TLines procedure SetFLineType(value:TLines) protected procedure Print(OfsX, OfsY : integer); override; procedure Paint Override public published property LineType:TLines Read FLineType Write SetFLineType end; |
|
procedure Register; implementation procedure TMyQRShape.SetFLineType(value:TLines); begin if value<>FLineType then begin FLineType:=value Invalidate end end procedure TMyQRShape.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 TMyQRShape.Print(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 Print(OfsX,OfsY ) end end end; procedure Register; begin RegisterComponents(‘QReport', [TMyQRShape]); end; end. |
上一篇文章: 和md5.asp结果一样的Delphi加密代码 下一篇文章: 用简单的Tracer类来为应用写入跟踪
相关文章:

