User Tools

Site Tools


k20:k20.4:k20.4.3:start

20.4.3 Project 3 - Demonstration Programme Print Screenshot

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

B1

Figure 20.4.3.1: Demonstration programme 'Print screenshot'.

B2

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

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k20/k20.4/k20.4.3/start.txt · Last modified: 22.10.2023 by emma

Page Tools