以下是引用吹水佬在2016-3-8 21:37:14的发言:
用报表监听器和GDI+示例
**
** 报表扩展功能示例(旋转)
**
CREATE CURSOR tt (ss C(10), ff I)
FOR i = 1 TO 10
INSERT INTO tt VALUES (PADL(i, 10, "0"), i)
ENDFOR
oRL = CREATEOBJECT("myReportListener")
oRL.ListenerType = 1
REPORT FORM 报表扩展功能示例(旋转).frx OBJECT oRL
DEFINE CLASS myReportListener AS ReportListener
DynamicLineHeight = .F.
IsRotate = .F.
PROCEDURE Init
DECLARE LONG GdipRotateWorldTransform IN GDIPlus.Dll LONG, SINGLE, LONG
DECLARE LONG GdipTranslateWorldTransform IN GDIPlus.Dll LONG, SINGLE, SINGLE, LONG
DECLARE LONG GdipSaveGraphics IN GDIPlus.DLL LONG, LONG@
DECLARE LONG GdipRestoreGraphics IN GDIPlus.DLL LONG, LONG
ENDPROC
PROCEDURE BeforeBand(nBandObjCode, nFRXRecNo)
DODEFAULT(nBandObjCode, nFRXRecNo)
this.IsRotate = INLIST(nBandObjCode, 1, 4, 7) && 标头、细节、注脚
ENDPROC
PROCEDURE AfterBand(nBandObjCode, nFRXRecNo)
this.IsRotate = .F.
DODEFAULT(nBandObjCode, nFRXRecNo)
ENDPROC
PROCEDURE Render(nFRXRecNo, nLeft, nTop, nWidth, nHeight,;
nObjectContinuationType, cContentsToBeRendered, GDIPlusImage)
LOCAL gState, x, y
gState = 0
IF this.IsRotate
x = nLeft + nWidth && 转点
y = nTop
GdipSaveGraphics(this.GDIPlusGraphics, @gState)
GdipTranslateWorldTransform(this.GDIPlusGraphics, x, y, 0)
GdipRotateWorldTransform (this.GDIPlusGraphics, -180, 0) && 逆转180度
GdipTranslateWorldTransform(this.GDIPlusGraphics, -x, -y, 0)
ENDIF
DODEFAULT(nFRXRecNo, nLeft, nTop, nWidth, nHeight, ;
nObjectContinuationType, cContentsToBeRendered, GDIPlusImage)
IF this.IsRotate
GdipRestoreGraphics(this.GDIPlusGraphics, gState)
ENDIF
NODEFAULT
ENDPROC
ENDDEFINE
代码好长,看不懂。
用报表监听器和GDI+示例
**
** 报表扩展功能示例(旋转)
**
CREATE CURSOR tt (ss C(10), ff I)
FOR i = 1 TO 10
INSERT INTO tt VALUES (PADL(i, 10, "0"), i)
ENDFOR
oRL = CREATEOBJECT("myReportListener")
oRL.ListenerType = 1
REPORT FORM 报表扩展功能示例(旋转).frx OBJECT oRL
DEFINE CLASS myReportListener AS ReportListener
DynamicLineHeight = .F.
IsRotate = .F.
PROCEDURE Init
DECLARE LONG GdipRotateWorldTransform IN GDIPlus.Dll LONG, SINGLE, LONG
DECLARE LONG GdipTranslateWorldTransform IN GDIPlus.Dll LONG, SINGLE, SINGLE, LONG
DECLARE LONG GdipSaveGraphics IN GDIPlus.DLL LONG, LONG@
DECLARE LONG GdipRestoreGraphics IN GDIPlus.DLL LONG, LONG
ENDPROC
PROCEDURE BeforeBand(nBandObjCode, nFRXRecNo)
DODEFAULT(nBandObjCode, nFRXRecNo)
this.IsRotate = INLIST(nBandObjCode, 1, 4, 7) && 标头、细节、注脚
ENDPROC
PROCEDURE AfterBand(nBandObjCode, nFRXRecNo)
this.IsRotate = .F.
DODEFAULT(nBandObjCode, nFRXRecNo)
ENDPROC
PROCEDURE Render(nFRXRecNo, nLeft, nTop, nWidth, nHeight,;
nObjectContinuationType, cContentsToBeRendered, GDIPlusImage)
LOCAL gState, x, y
gState = 0
IF this.IsRotate
x = nLeft + nWidth && 转点
y = nTop
GdipSaveGraphics(this.GDIPlusGraphics, @gState)
GdipTranslateWorldTransform(this.GDIPlusGraphics, x, y, 0)
GdipRotateWorldTransform (this.GDIPlusGraphics, -180, 0) && 逆转180度
GdipTranslateWorldTransform(this.GDIPlusGraphics, -x, -y, 0)
ENDIF
DODEFAULT(nFRXRecNo, nLeft, nTop, nWidth, nHeight, ;
nObjectContinuationType, cContentsToBeRendered, GDIPlusImage)
IF this.IsRotate
GdipRestoreGraphics(this.GDIPlusGraphics, gState)
ENDIF
NODEFAULT
ENDPROC
ENDDEFINE