AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones de ventanas
  • Printing the screen where the current window is displayed
WinScreenRectangle (Example)
Printing the screen where the current window is displayed
The following code is used to print the screen where the current window is displayed.
IMG_DEST is an invisible Image control found in the current window
// Temporary name of the image
sTempName is string
sTempName = fTempFile()
 
// Dimensions of the screen that displays the current window
sInfoCurrentScreen is string
sInfoCurrentScreen = WinScreenRectangle("", screenWithoutTaskbar)
 
// Result: <X1> + TAB + <Y1> + TAB + <x2> + TAB + <Y2>.
// To print all the screens in multi-screen, you should use the functions:
// SysListScreen(), SysScreenRectangle()
 
nXScreen, nYScreen, nScreenWidth, nScreenHeight are int
nXScreen = ExtractString(sInfoCurrentScreen, firstRank)
nYScreen = ExtractString(sInfoCurrentScreen, nextRank)
nScreenWidth = Abs(Val(ExtractString(sInfoCurrentScreen, nextRank)) - nXScreen)
nScreenHeight = Abs(Val(ExtractString(sInfoCurrentScreen, nextRank)) - nYScreen)
 
// Modify the size of the Image control to adapt it to the size of the screen
IMG_DEST.Width = nScreenWidth
IMG_DEST.Height = nScreenHeight
 
// Copy the screen into the Image control
dCopyImage(copyScreen, IMG_DEST, copySrcCopy, ...
nXScreen, nYScreen, nScreenWidth, nScreenHeight, 0, 0, nScreenHeight, nScreenWidth)
 
// Save the image in a temporary file
dSaveImageJPEG(IMG_DEST, sTempName, 90)
 
// Clears the Image control (frees the memory)
IMG_DEST = ""
 
// Open report viewer
iDestination(iViewer)
 
// Print image
iPrintImage(sTempName, 0, 0, iPageWidth(), iPageHeight(), iHomotheticDisplay)
iEndPrinting()
 
// Delete temporary file from image
fDelete(sTempName)
Versión mínima requerida
  • Versión 17
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 10/02/2023

Señalar un error o enviar una sugerencia | Ayuda local