Question:
How can I run an image viewer in a window portion of a form in Visual FoxPro alongside a scrolling list box?
Answer:
Here is how to create a form with a thumbnail preview in VFP without any ActiveX control:
- Create a form.
- Drop an image object onto the form (name it “imgPict”).
- Set the Stretch to 2 (Stretch).
- Drop a listbox onto the form (name it “lstFiles”).
- Set the RowSourceType to 7 (files).
- Set the RowSource to “*.bmp”.
- Put the following code into the InteractiveChange of the listbox:
thisform.imgpict.picture = this.Value
- Put some BMP files in the current directory.
Run the form, scroll through the BMP files in the listbox, and watch the thumbnail change. This is limited to the types of pictures that VFP can show on a form (VFP can show only BMP and ICO; VFP 6 has more, including GIF, etc.).