Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSCHART Printing
Message
From
10/10/2003 17:49:45
 
 
To
10/10/2003 17:32:09
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00837680
Message ID:
00837686
Views:
30
>Hi,
>
>I am using the MSChart control with VFP6.0. I have the chart working good. Now, I want to be able to send that chart out to a printer. Ideas? Thanks!
>
>Tim

Hi Tim

as far as i know there is no direct way to do this. However, i have used the following code which uses a "PrintScreen" method, only that it does not print the entier screen, but only the "formost window". because i did not want to print any of my controls in the form (ONLY the chart) i used the "Hwnd" from the chart itself.
You have to modify this to the object pointers to your scenario.

hope this helps.
LOCAL ;
   lcJobName, ;	&& Print job name
   lnRetVal	&& Return value from API functions
		
tnHWnd      = ThisForm.Pageframe1.ReportGraph_Page.Chartarea1.Hwnd
lcJobName   = "MM Chart Print"

DECLARE INTEGER PrintWindow IN DibApi32 ;
   INTEGER HWND, ;
   INTEGER fPrintArea, ;
   INTEGER fPrintOpt, ;
   INTEGER wxScale, ;
   INTEGER wyScale, ;
   STRING @ szJobName

#DEFINE PW_WINDOW 1
#DEFINE PW_CLIENT 2

#DEFINE PW_BESTFIT       1
#DEFINE PW_STRETCHTOPAGE 1
#DEFINE PW_SCALE         3

#DEFINE MB_ICONEXCLAMATION 48
#DEFINE MB_OK 0

lcJobName = lcJobName + CHR(0)
lnRetVal  = PrintWindow(tnHWnd, PW_WINDOW, PW_STRETCHTOPAGE, 0, 0, @lcJobName)

IF lnRetVal != 0
   IF lnRetVal != 6
      = MESSAGEBOX(;
         "Unable to print the window", ;
         MB_ICONEXCLAMATION + MB_OK, ;
         "Print Problem...")
   ENDIF
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform