The third project shows you how to print a screenshot of the entire desktop in a very convenient way using the gb.report (report designer) component. The project is based on an idea by Fabien Bodard (2012).
Figure 20.4.3.1: Demonstration programme 'Print screenshot'.
Figure 20.4.3.2: Report View → Print Preview
Before printing, you can select the printer and adjust the print options.
The source code for the print programme is surprisingly clear due to the use of the gb.report component:
Public Sub Form_Open() FMain.Resizable = False End Public Sub btnScreenshot2Printer_Click() Dim hImage As Image Dim hReport As New Report Dim hReportLabel As New ReportLabel(hReport) Dim hRepImg As New ReportImage(hReport) hReport.Orientation = Printer.Landscape hReport.Padding = ReportPadding["2 cm"] hReport.Spacing = "1 cm" hReport.Paper = Printer.A4 hReportLabel.Text = "Print screen copy" hReportLabel.Autoresize = True hReportLabel.Alignment = Align.Center hReportLabel.Font.Size = 24 FMain.Visible = False Wait 0.05 hImage = Desktop.Screenshot().Image FMain.Visible = True hRepImg.Image = hImage hRepImg.Autoresize = True hRepImg.Stretch = Report.Proportional hRepImg.Expand = True hReport.Preview() End
Chapter & Project