QuickBasic for Macintosh: Drawing a PICT File Larger Than 32K (95482)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0

This article was previously published under Q95482

SUMMARY

When the PICTURE statement is used to draw PICT files, the PICT file is put in a string variable to be displayed. However, strings have a maximum size of 32,767 characters; therefore, a picture file larger than this cannot be displayed with PICTURE.

MORE INFORMATION

To work around this limitation, the picture must be put into a resource file and drawn with calls to the Toolbox Library. To do this, follow the steps below using ResEdit 2.1. Different versions of ResEdit may require modifications to the steps below.

  1. Start the drawing application that created the picture file, and load the picture.
  2. Select the picture and copy it to the Clipboard.
  3. Quit the drawing application and start ResEdit.
  4. From the File menu, choose New and give the new file a name. This will be the resource file that holds the picture.
  5. From the Resource menu, choose Create New Resource.
  6. For the type of resource, enter PICT. Make sure the letters are capitalized, then choose the OK button.
  7. From the Edit menu, choose Paste. This will paste the entire picture into the PICT resource.
  8. Make a note of the PICT ID number for this picture. It is at the bottom of the Picture window, and you will need it to pull the picture into QuickBasic. This number can be changed by choosing Get Resource Info from the Resource menu, if desired.
  9. From the File menu, choose Save menu to save the resource file.
  10. Use the following code to pull the resource PICT file into QuickBasic:
           '  This code will read picture ID 128 from a resource file
           '  created with ResEdit.
    
           SUB drawpict (pictid%,pictfile$)
           ' pictid% is the picture ID in the resource file from step 8
           ' above. pictfile$ is the name of the picture file from step 4
           ' above.
    
             ref% = 0              ' This must be initialized to zero or
                                   ' you will get an error message.
             handle& = 0           ' This also must be initialized to
                                   ' zero.
    
             OpenResFile pict$,ref%' This opens the resource file that
                                   ' you created with ResEdit.
             GetPicture ref%,pictid%,handle& ' This returns a handle to
                                             ' the picture resource so
                                             ' we can use it.
             DrawPicture handle&   ' This will draw it. See manual for
                                   ' changing draw location.
           END SUB
    						
For more information, see these publications:

  • "Inside Macintosh Volume V," "Picture Compatibility," page V-92, by Apple Computer, Inc.
  • "Microsoft QuickBasic: Language Reference," Appendix E, GetPicture, DrawPicture, and other Toolbox routines
Also query on the following words in the Microsoft Knowledge Base:

making and bitmap and resource and openpicture and addpicture
making and pict and resource and picture$ and savepicture


Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB95482