Microsoft KB Archive/50806

= PICTURE ON Does Not Capture Picture after WINDOW Change =

Article ID: 50806

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Interpreter 2.0
 * Microsoft BASIC Interpreter 2.1 for Macintosh
 * Microsoft BASIC Interpreter 3.0 for Macintosh

-



This article was previously published under Q50806



SUMMARY
The PICTURE ON/OFF statements cannot capture graphics sent to several different WINDOWs. PICTURE ON only captures a graphics image in the WINDOW that is active when the PICTURE ON statement is executed. If the WINDOW being output to is changed, or another WINDOW is created after the PICTURE ON statement, any graphics output to that other WINDOW is not captured.



MORE INFORMATION
The correct order of statements for capturing a PICTURE$ with PICTURE ON/OFF is as follows:


 * 1) Create the WINDOW you want to use with the WINDOW statement, or make an already existing WINDOW active with the WINDOW OUTPUT statement. Either one of these actions will set the currently active output WINDOW. If the program is just using the default WINDOW, this step is not necessary.
 * 2) Use PICTURE ON to begin recording graphics output to the WINDOW you just made active.
 * 3) Normally, PICTURE ON issues a CALL to HIDEPEN. This means that to watch the graphics as they are being drawn and recorded, you must invoke SHOWPEN immediately after the PICTURE ON statement.
 * 4) While the graphics are being drawn, do not make any other WINDOW active by issuing a WINDOW statement or WINDOW OUTPUT statement. Any graphics output to a WINDOW other than the one that was active when the PICTURE ON was activated will not be recorded.
 * 5) When the graphics are complete, use the PICTURE OFF statement to terminate recording of graphics.
 * 6) You now can invoke the PICTURE$ function to return a string containing the graphics information [ x$=PICTURE$ ]. You can redraw the stored picture with the PICTURE statement [ PICTURE,x$ ].

Code Example
The following code example demonstrates the correct steps described above: ScrW% = SYSTEM(5) ' Get the screen width and height. ScrH% = SYSTEM(6) ' Create and set an active WINDOW. WINDOW 2,&quot;Recording Picture&quot;,(10,40)-(ScrW%-20,ScrH%-20),5 PICTURE ON   ' Start recording graphics. SHOWPEN         ' View the graphics as they draw.

FOR W=9 TO 20.3 STEP .01 a=60 x=R*COS(W) y=R*SIN(W) dr=R-R*SIN(W-.05) dy=y-R*SIN(W-.05) dx=x-R*COS(W-.1) R=a PSET(300+x-x*SIN(W/2)*dx,200+y+y*COS(W/2)*dy) NEXT W scrn: PICTURE OFF x$=PICTURE$ WINDOW CLOSE 2 ' Output now goes to the default WINDOW. PICTURE(1,1)-(ScrW%,ScrH%),x$   ' Scales the size of output LOCATE 10, 10 INPUT &quot;Hit any key to end the program.&quot;, a$ END

Additional query words: BasicCom MQuickB

Keywords: KB50806

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.