文章來(lái)源:互聯(lián)網(wǎng)
*********************************************************
* vfp9終結(jié)一直以來(lái)關(guān)于打印紙張?jiān)O(shè)置
* 過(guò)程名稱:MyReport.prg
* 調(diào)用方式:MyReport(ReportName, Height, Width)
* 當(dāng) Height和Width為空時(shí),,默認(rèn)A4紙
* 程序原創(chuàng):dupeiji
* 最后修改:pnyjq
* 修改日期:2005-03-23
* 待解決問(wèn)題:當(dāng)ListenerType = 1時(shí)無(wú)法正常預(yù)覽
*********************************************************
Parameters lcFRX, nHeight, nWidth
Local loReportListener
If Empty(lcFRX)
Return
Endif
loReportListener = Createobject("Test")
#DEFINE A4_Height 29.7
#DEFINE A4_Width 21
loReportListener.sHeight=Icase(Empty(nHeight), A4_Height, nHeight)
loReportListener.sWidth=Icase(Empty(nWidth), A4_Width, nWidth)
Report Form (lcFRX) Object loReportListener
Define Class Test As ReportListener
ListenerType = 0
sHeight=0
Procedure GetPageHeight()
If This.sHeight >0
Return This.sHeight * 377.95
Else
Return DoDefault()
Endif
Endproc
sWidth=0
Procedure GetPageWidth()
If This.sWidth >0
Return This.sWidth * 377.95
Else
Return DoDefault()
Endif
Endproc
Procedure OutputPage(nPageNo, eDevice, nDeviceType, nleft, nTop, nWidth, nHeight)
t_sHeight=This.sHeight
This.sHeight=0
nHeight=t_sHeight * 377.95 * nHeight/This.GetPageHeight()
This.sHeight=t_sHeight
t_sWidth=This.sWidth
This.sWidth=0
nWidth=t_sWidth * 377.95 * nWidth/This.GetPageWidth()
This.sWidth=t_sWidth
DoDefault(nPageNo, eDevice, nDeviceType,nleft, nTop, nWidth, nHeight)
Nodefault
Endproc
Enddefine
|