Hello All,
I am saving a snapshot of my form to a PNG file. The form is 1100 x 800 pixels and I have the following in my code:
Then to take a a snapshot every minute, I use a timer with the following code:
The code works fine and the PNG file is created as expected. However the size of the PNG file is always 2000 x 1131 pixels when I expected it to be the size of the mainform which is 1100 x 800.
Is there any way to get it to create the PNG of the same size as the mainform?
Any pointers on this issue would be greatly appreciated as I have now tried almost everything to change the PNG size from 2000 x 1131 but nothing works.
Thanks!
I am saving a snapshot of my form to a PNG file. The form is 1100 x 800 pixels and I have the following in my code:
B4X:
#Region Project Attributes
#MainFormWidth: 1100
#MainFormHeight: 800
#End Region
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.WindowWidth = 1100
MainForm.WindowHeight = 800
MainForm.Resizable=False
MainForm.Show
.
.
.
Then to take a a snapshot every minute, I use a timer with the following code:
B4X:
Sub Timer3_tick
Dim out As OutputStream = File.OpenOutput(File.DirApp, "temps.png", False)
MainForm.RootPane.SetSize(1100,800)
MainForm.RootPane.Snapshot.WriteToStream(out)
out.Close
End Sub
The code works fine and the PNG file is created as expected. However the size of the PNG file is always 2000 x 1131 pixels when I expected it to be the size of the mainform which is 1100 x 800.
Is there any way to get it to create the PNG of the same size as the mainform?
Any pointers on this issue would be greatly appreciated as I have now tried almost everything to change the PNG size from 2000 x 1131 but nothing works.
Thanks!