Platforms to show: All Mac Windows Linux Cross-Platform

ScreenshotRectMBS(left as Integer, top as Integer, width as Integer, height as Integer) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Screenshot MBS Picture Plugin ✅ Yes ✅ Yes ✅ Yes ❌ No All
Returns a picture of the screen rectangle in screen resolution.
Example
// write picture of window to desktop
#if TargetMacOS then
const f = 1
#else
Var f as double = screen(0).ScaleFactor
#endif

Var p as Picture = ScreenshotRectMBS(self.left*F, self.top*F, self.Width*F, self.Height*F)
Var ff as FolderItem = SpecialFolder.Desktop.Child("test.jpg")

p.Save(ff, p.SaveAsJPEG)

Improved in Version 3.2 to support multiple displays on Mac OS.

Plugin Version 10.4 adds Windows support.
Coordinates given in pixel on screen, so for High DPI on Windows, you need to multiply them before passing parameters.

Some examples using this global method:

Blog Entries

Xojo Developer Magazine

The items on this page are in the following plugins: MBS Picture Plugin.


The biggest plugin in space...