Making PICT Resource with PICTURE$ Picture and SavePicture

Article translations Article translations
Article ID: 43021
This article was previously published under Q43021
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

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 "circle",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%
				

Properties

Article ID: 43021 - Last Review: February 27, 2014 - Revision: 1.2
Keywords: 
kbnosurvey kbarchive KB43021

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com