Platforms to show: All Mac Windows Linux Cross-Platform
/Picture/Screenshot/Screenshot
Required plugins for this example: MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Screenshot/Screenshot
This example is the version from Wed, 14th May 2019.
Project "Screenshot.xojo_binary_project"
Class PicWindow Inherits Window
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
If pic <> Nil Then
g.drawpicture pic,0,0,pic.Width,pic.Height,0,0,pic.width,pic.height
End If
End EventHandler
End Control
Property pic As Picture
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class Window2 Inherits Window
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
details
End EventHandler
End Control
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
If pic <> Nil Then
g.drawpicture pic,0,0,pic.Width,pic.Height,0,0,pic.width,pic.height
End If
End EventHandler
End Control
EventHandler Sub Open()
left=500
End EventHandler
Sub details()
dim q as picture
dim x as integer
dim y,w,h as integer
w=width
h=height
'x=min(max(0,system.mousex-w/4),screen(0).width-150)
'y=min(max(0,system.mousey-h/4),screen(0).height-150)
x=system.mousex-w/4
y=system.mousey-h/4
if lastx<>x or lasty<>y then
lastx=x
lasty=y
q=ScreenshotRectMBS(x,y,w/2,h/2)
if q<>Nil then
pic = q
out.invalidate
End If
end if
End Sub
Property Protected lastx As integer
Property Protected lasty As integer
Property pic As Picture
End Class
Class App Inherits Application
EventHandler Sub Open()
Dim c As Integer = ScreenCount-1
For i as integer = 0 To c
Dim w As New PicWindow
w.pic = ScreenshotDisplayMBS(i)
w.Title = "Screen "+Str(i)
w.width = Screen(0).Width/2
w.height = Screen(0).height/2
Next
window2.show
End EventHandler
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Picture Plugin.