User Tools

Site Tools


Sidebar

Multimedia

k23:k23.5:start

23.5 Screen copy - screenshot

A project is presented with which you can make a screen copy and print it out immediately. A report is used into which the screen copy is inserted. Printing is carried out by the print module in the report. This makes the source text short and very clear. Among other things, you can specify in the dialogue whether you want to print the screen in colour or greyscale. It is also possible to save the screen copy as a PDF file.

Complete source code:

' Gambas class file
' Adaption: Hans Lehmann + Osterburg + 2021/2024
 
Public Sub Form_Open()
  FMain.Center()
  FMain.Resizable = False
End
 
Public Sub btnMake_Click()
 
    Dim hScreenshotImage As Image
    Dim hReport As New Report
    Dim hReportLabel As New ReportLabel(hreport)
    Dim hReportImage As New ReportImage(hReport)
 
'-- Printout: DIN A4 landscape format (default setting)
    hReport.Paper = Printer.A4
    hreport.Orientation = Printer.Landscape
    hreport.Padding = ReportPadding["2 cm"]
    hReport.Spacing = "1 cm"
 
    hReportLabel.Text = "Printing a screen copy (screenshot)"
    hReportLabel.Autoresize = True
    hReportLabel.Alignment = Align.Center
    hReportLabel.Font.Size = 24
 
'-- The programme window is hidden
    FMain.Hide()
      Wait 0.2
 
      hScreenshotImage = Desktop.Screenshot().Image
 
'-- The programme window is displayed again
    FMain.Show()
 
'-- The screenshot image is inserted into the report
    hReportImage.Image = hScreenshotImage
    hReportImage.Autoresize = True
    hReportImage.Stretch = Report.Proportional
    hReportImage.Expand = True
 
'-- Print dialogue ⇉ Preview of the report 
    hReport.Preview()
 
End

p2

Figure 23.5.1: Print dialogue

The programme window only shows one button:

p3

Figure 23.5.2: Programme window

Download

Chapter & Projects

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.
k23/k23.5/start.txt · Last modified: 08.03.2024 (external edit)

Page Tools