You can minimize, maximize and restore the form programmatically using the MinimizeForm, MaximizeForm and RestoreForm methods.
This command restores the form to the size it was before it was maximized:
To find out whether the form has been minimized, maximized or not, use the WindowState property of the form. The WindowState can be minimized, maximized or normal. This code shows the form's window state in a message box when the form is closed:
USE BUILTIN(OV_MESSAGE_BOX) WITH_ARGS(#FORMC.WINDOWSTATE)