There are things that you should never use. AnchorPane is one of them.
Form.BackColor is only relevant if you want to create a transparent form. It is simpler to set the RootPane color.
You can make it transparent:
Sub paintDesktop(frm As Form)
MainForm = frm
'MainForm.RootPane.LoadLayout("teclado_numerico") 'Load the layout file.
Dim x As B4XView = MainForm.RootPane
x.Color = xui.Color_Transparent
Though I recommend you to create a layout for the form and load it. Set the color of Main to be gray.