My prior 2 posts show how to display multiple photos on a VB.Net form, first using the PictureBox control, the second drawing to the form directly. Below is some code to display multiple photos on a Fox form using an array of Fox Image controls. These controls are windowless: you can use Spy++ to verify.

It gives each image a name in the form of “imxxyy”, like “im0101” and “im0912”.

 

For another sample of an array of controls, see the Fox version of the Minesweeper game (Tools->Task Pane->MineSweeper). The source code can be found in Tools\xsource\xsource.zip, VFPSource\TaskPane\PaneCache\Microsoft.minesweeper\mines.prg

 

#define CWIDTH 2

PUBLIC ox

ox=CREATEOBJECT("MyForm")

ox.Show()

 

DEFINE CLASS MyForm AS Form

          Allowoutput=.f.

          xPix=12

          yPix=9

          picwidth=160  && default thumbnail dim

          picheight=120

          width=1024

          height=768

 

          PROCEDURE init

                   USE d:\pictures\pixthumb

                   this.picwidth = this.Width / this.xpix

                   this.picheight = this.Height / this.ypix

                   this.DoArray()

          PROCEDURE keypress(nKeyCode, nShiftAltCtrl)

                   this.DoArray           

          PROCEDURE DoArray

                   local xx,yy,cname,oi

                   for yy = 1 to thisform.ypix

                             for xx = 1 to thisform.xpix

                                      cname = "im"+padl(yy,CWIDTH,'0')+padl(xx,CWIDTH,'0')

                                      cstr="thisform."+cname

                                      IF VARTYPE(&cstr) != 'O'               && If it hasn't been added yet

                                                thisform.AddObject(cname,"myimage")

                                                oi = EVALUATE("THISFORM."+CNAME)

                                                oi.height = thisform.picheight

                                                oi.width = thisform.picwidth

                                                oi.top = 20 + oi.height * (yy - 1)

                                                oi.left = (xx - 1) * oi.width

                                                oi.visible=1

                                      ELSE

                                                oi = EVALUATE("THISFORM."+CNAME)

                                      ENDIF

                                      oi.pictureval=thumb

                                      skip

                             ENDFOR

                   ENDFOR

ENDDEFINE

DEFINE CLASS MyImage as Image

          * Add your own event handlers,etc.

ENDDEFINE