Microsoft KB Archive/43021

= Making PICT Resource with PICTURE$ Picture and SavePicture =

Article ID: 43021

Article Last Modified on 11/21/2006



This article was previously published under Q43021



SUMMARY
There are two routines you can use to write a picture to the resource fork of a file: SavePicture and AddPicture.

This article describes how to use SavePicture to save an image as a PICT resource that was recorded in the QuickDraw string format using the PICTURE ON and PICTURE OFF statements.

An alternate method is to record the picture as a bitmap with OpenPicture and ClosePicture, and save it as a PICT resource with the AddPicture routine. For more information, query in this Knowledge Base on the following words:

OpenPicture AddPicture



MORE INFORMATION
You can record a picture as a string of QuickDraw calls with the PICTURE ON and PICTURE OFF statements. This string can be translated to a picture with the PICTURE$ function and written to the resource fork of a file with SavePicture. SavePicture is an MBLC routine that is built into QuickBASIC.

Once you save the picture in the resource fork of a file, you can use ResEdit or a BASIC program to move it to the resource fork of another file or application. (However, this QuickDraw string format will not be viewable in ResEdit.) You can retrieve the picture into a string variable with the LoadPicture routine, and redraw it with QuickBASIC's PICTURE statement.

Code Example
' Example of how to save a picture saved as a string ' to the resource fork of a file ' Open a file to hold your resource: ref% = 0 OpenResFile &quot;circle&quot;,ref%

' Draw your picture: PICTURE ON   ' Turn on recording of picture CALL SHOWPEN  ' Turns on screen pen to see drawing while recording CIRCLE (100,100),25 ' Any drawing statements go here PICTURE OFF  ' Turn off recording of picture image$ = picture$ 'Retrieve picture string stored as QuickDraw calls

' Place the finished picture in the resource fork of the file: id% = 1 SavePicture ref%,id%,image$ CloseResFile ref%

Additional query words: MQuickB

Keywords: KB43021

-

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

© Microsoft Corporation. All rights reserved.