2023-04-16

Capture Form portions - FoxyCapture

Recently Tom Knauf from Germany asked for a feature in FoxyPreviewer3 to allow users to pick specific parts of their reports and export them to the clipboard or save as image in an easy way.

Nothing new on this, I even published about 10 years ago a solution for that, but it was not working anymore.

So, I took the opportunity to create it from scratch, but this time thinking of a good way to make it work safely with FoxyPreviewer3.

FOXYCAPTURE is a custom VFP class that you can toss in any VFP form.

To activate it, just call the method "StartCapture", and select the rectangle portion of your form you's like to capture. After dragging, a shortcut menu will allow you to either save as PNG or send the image to the clipboard.

Source code and a sample form included, please let me know if you find any issues or make any improvements.

Below some animated images showing how it works.


Picture1 - Capture to image file



Picture2 - Capture image to the clipboard, and paste it to WhatsApp web:


Files to include in your project:

  • FoxyCapture.vcx
  • FoxyCapture.vct
  • fc_Save.Bmp
  • fc_Clipboard.bmp


Related Methods / Properties

Method:

StartCapture - Starts capturing the mouse events to capture the form surface


Properties:

BorderColor - Numeric, the RGB value of the border color to drawn to determine the rectangle to be captured

ShowBorder - Logical, determines if the dotted shape borders will appear in the captured image or not


Download link:

LATEST UPDATES

- 2023-04-22 v1.04 - Now instead of trying to bind all the form objects it draws an invisible container on the screen, where the dotted rectangle used for selecting the screen contents is drawn.
This brought the advantage of allowing to select any part of the form, Grids, PageFrames, Textboxes, etc, without the need of Disabling objects. Forms with grids are working fine as well.


No comments:

Post a Comment