Question:
How can I print a screen?
Solution:
The following example illustrates how to print the current screen with a button click. First of all, you will need to create a formatted report. To do so, follow these procedures:
- Access the Organizer (Alt+O) and select the item Report.
- Click New and select Formatted Report.
- While selecting Report (Form1), click on Edit.
- Insert a Bitmap object onto the report (Objects->Bitmap) with the appropriate size;
- Close the report’s window.
Then, it will be necessary to set up a button to print the report. To do so, follow these procedures:
- Insert a button onto screen that will access its properties with a double click.
- Go to Scripts tab and click New.
- Select OnRelease event and click on OK.
- Paste the following script in the new event:
CaptureScreen(“C:\test.bmp”) //saves screen capture in a file in the hard disk
Bitmap1.bitmapName = “test.bmp” //configures the bitmap in the formatted report with the figure of the captured screen
Form1.Print() //prints screen
Bitmap1.bitmapName = “test.bmp” //configures the bitmap in the formatted report with the figure of the captured screen
Form1.Print() //prints screen
NOTE: The printer used by the report is set up in Organizer->Reports->My Report -> Printer