Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Sorry about that. Here it is.
*PROCEDURE PrintWindow
LPARAMETERS tnHWnd, tcJobName
LOCAL lcJobName && Print job name
LOCAL lnRetVal && Return value from API functions
DECLARE INTEGER PrintWindow IN DibApi32 ;
INTEGER HWnd, ;
INTEGER fPrintArea, ;
INTEGER fPrintOpt, ;
INTEGER wxScale, ;
INTEGER wyScale, ;
STRING @ szJobName
*!* Print entire window or just client area
#DEFINE PW_WINDOW 1
#DEFINE PW_CLIENT 2
*!* How to size the printed image
*!* PW_BESTFIT resizes to fill paper while retaining proportions
*!* PW_STRETCHTOPAGE resizes to completely fill paper, distorts proportions
*!* PR_SCALE scale print size
#DEFINE PW_BESTFIT 1
#DEFINE PW_STRETCHTOPAGE 2
#DEFINE PW_SCALE 3
*!* If you are not including FoxPro.H uncomment these lines
*!* #DEFINE MB_ICONEXCLAMATION 48
*!* #DEFINE MB_OK 0
lcJobName = tcJobName + CHR(0)
lnRetVal = PrintWindow( tnHWnd, PW_WINDOW, PW_BESTFIT, 0, 0, @lcJobName)
IF lnRetVal != 0
IF lnRetVal != 6 && 6 = User canceled printing
= MESSAGEBOX("Unable to print the window" + CRLF + ;
"PrintWindow API call returned " + STR(lnRetVal), ;
MB_ICONEXCLAMATION + MB_OK, ;
"ERROR MESSAGE TITLE")
ENDIF
ENDIF
*RETURN
>Hello Dale,
>
>It appears your application class has a method called PrintWindow(). What code is in that method()?
>
>>I'm pretty sure I received this tip from somebody on the UT a couple years ago. Wish I knew who to give the credit to. Anyway, the following works for me.
>>
>>I created a button on my toolbar to hold the following code:
>>
>>if type("_screen.activeform") = "O"
>> _screen.activeform.printform()
>>else
>> wait wind "You can't use this unless an application form is active"
>>endif
>>
>>In my form class I added a method called printform. The following is the code for that method.
>>
>>DECLARE INTEGER GetFocus IN WIN32API
>> oApp.PrintWindow(GetFocus(), "PRINT JOB TITLE")
>>
>>Hope this helps.
>>
>>Dale
>>
>>
>>
>>>How would you give user ability to screen print only active form to
>>>printer and specify landscape / portrait?
>>>I want to prevent having to re-draw the form as a report since the
>>>form is excactly what needs to print.
>>>I know user can do screen print but it will have all of the background
>>>stuff in it.
>>>
>>>thanks in advance.
>>>
>>>Ronnie
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement