I'm using this code:
To take snapshot of an area of the control, however this will only work on windows 10. I would have to write different code for this for each platform which would be a pain. Is there any way that I can change the "8" and the "31" to something that will work for all platforms.
Basically the wl and wt start at the window left and top position, but the numbers afterwards are there to cut out eh title bar and the side border.
Using
and
instead of those 2 numbers doesn't work at all.
B4X:
Dim joR As JavaObject
Dim wl As Int = MainForm.WindowLeft + 8
Dim wt As Int = MainForm.WindowTop + 31
Dim wh As Int = Template.Height
Dim ww As Int = Template.Width
joR.InitializeNewInstance("java.awt.Rectangle", Array As Object(wl, wt, ww, wh))
Dim joRobot As JavaObject
joRobot.InitializeNewInstance("java.awt.Robot", Null)
Dim joF As JavaObject
joF.InitializeNewInstance("java.io.File", Array As Object(DirUserDefault, ExportText.Text & expType.ToLowerCase))
Dim joWI As JavaObject
joWI.InitializeStatic("javax.imageio.ImageIO")
joWI.RunMethod("write", Array As Object(joRobot.RunMethod("createScreenCapture", Array(joR)), "PNG", joF))
To take snapshot of an area of the control, however this will only work on windows 10. I would have to write different code for this for each platform which would be a pain. Is there any way that I can change the "8" and the "31" to something that will work for all platforms.
Basically the wl and wt start at the window left and top position, but the numbers afterwards are there to cut out eh title bar and the side border.
Using
B4X:
Template.Left
B4X:
Template.Top