Printing Images in Visual FoxPro 9.0

There are plenty of ways to do this and one of the easiest way by far is by using reports but since I can’t help but be attached to old things, we’ll do it the old way, the FoxPro for DOS way.
1. Design your form as follows:


2. Double-click the control named PrintButton and enter the following:
  1. *Turns on the printer  
  2. SET PRINTER ON  
  3. *Prevent the data being printed from appearing on the screen  
  4. SET CONSOLE OFF  
  5. *Sends whatever specified in the @SAY command directly to the printer  
  6. *This is one of the important lines of code, without this, the image  
  7. * will not be printed at all  
  8. SET DEVICE TO PRINTER  
  9. *Displays an explainatory text just to let the user know that the data is being printed  
  10. WAIT WINDOW 'Printing...' TIMEOUT 3  
  11. *Displays our image in a specified row and column coordinate  
  12. *We use stretch so that the size of the image will adjust to  
  13. *the size of the image control  
  14. @ 1,5 SAY Thisform.iconimagecontrol.picture BITMAP SIZE 5,10 STRETCH  
  15. * Displays our text  
  16. @ 6,5  SAY 'Application Name:' +  thisform.Appnamelabel.Caption  
  17. *Ejects the paper  
  18. EJECT  
  19. *Stops sending data to the printer  
  20. SET PRINTER OFF  
3. Here's the code again and this time I’ve omitted the comments coz it's kinda messy or something:
  1. SET PRINTER ON  
  2. SET CONSOLE OFF  
  3. SET DEVICE TO PRINTER  
  4. WAIT WINDOW 'Printing...' TIMEOUT 3  
  5. @ 1,5 SAY Thisform.iconimagecontrol.picture BITMAP SIZE 5,10 STRETCH  
  6. @ 6,5  SAY 'Application Name:' +  thisform.Appnamelabel.Caption  
  7. EJECT  
  8. SET PRINTER OFF  

4. Double-click the ExitButton and enter the following:
  1. *Quits the form  
  2. RELEASE THISFORM  

5. Click the Run icon or press CTRL + E> Click the Print button. Here’s a sample print out of how it should look like. I’ve tried it using EPSON LX 300 printer.


6. So there...

Bicore Headbot

Bicore Headbot is a photovore(light seeking robot) that looks for the brightest light source and turns its head there. Here is a bicore headbot made by one of my appreciated students whose name you’ll see at the end of the video. This was based on the book “JunkBots, Bugbots, and Bots on Wheels:Building Simple Robots using BEAM technology” by Mark Tilden. Enjoy!