devxlogo

Running an Image Viewer in a Window

Running an Image Viewer in a Window

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:

  1. Create a form.
  2. Drop an image object onto the form (name it “imgPict”).
  3. Set the Stretch to 2 (Stretch).
  4. Drop a listbox onto the form (name it “lstFiles”).
  5. Set the RowSourceType to 7 (files).
  6. Set the RowSource to “*.bmp”.
  7. Put the following code into the InteractiveChange of the listbox:
    thisform.imgpict.picture = this.Value

  8. 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.).

See also  How IoT Tech Will Transform Logistics
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist