Mega Code Archive

 
Categories / Delphi / Examples
 

Form resembling a paper form

Technique for creating a Delphi form that looks the same as the original paper version of the form. Introduction It is easier to transcribe information from a paper form to a computer form the more closely the latter resembles the former. Furthermore, the transcription results are likely to be more accurate. One way of making a Delphi form that resembles a paper form is to use a scanned image of a blank copy of the paper form as a background for the Delphi form and to make the Delphi data controls "float" over the background. This is very easy to do using Delphi yet I have not noticed the technique described elsewhere. How to do it Create a new application and add whatever components you need to use the database in which you will store information from the new form. Drop a Scrollbox component onto a suitable place on the form, and then put an Image component into the scrollbox. The Align and Autosize properties of the image component should be set to None and True respectively. Now load your scanned image of the paper form into the image component. If the image is larger than the space available for it either or both scrollbars will appear. Adjust the scrollbar(s) so that the first field in the paper form is visible. Drop the appropriate Delphi Data Control component into the space for that field, and connect the control to your database. Repeat the previous step until you have dealt with all of the fields on the form. There it is, a Delphi version of the original paper form. Beauty. What this recipe fails to mention is the problems that arise with varying screen sizes and resolutions, etc. This approach works well within a single organisation in which IT/IS staff have control over screen sizes and resolutions as well as other factors. However, to provide more resilient solutions it is probably necessary to arrange to resize components and fonts dynamically to suit display characteristics. Nonetheless, this can be a useful approach at times.