Below is code that is attached at the Form Level. I use this code on all my applications so that it will automatically resize the forms regardless of what the individual user has set his screen for.
Methods - Var
ThisForm Form
AspRatio Number
Events - SetFocus
MenuAction(MenuPropertiesZoomFitWidth)
Events - Open
Var
ix, iy,
iw, ih LongInt
EndVar
if eventInfo.isPreFilter() then
else
;// This code executes only for the form
DoDefault
Thisform.attach()
Thisform.GetPosition(ix,iy,iw,ih)
AspRatio = Number(iw) / Number(ih)
maximize()
endIf
Events - KeyPhysical
if eventInfo.isPreFilter() then
;// This code executes for each object on the form
if GetNetUserName() = "acmulfor" then
else
Switch
Case eventinfo.vchar() = "VK_F7":
DisAbleDeFault
msgstop("Error","Action Not Allowed"
Case eventinfo.vchar() = "VK_F5":
DisAbleDeFault
msgstop("Error","Action Not Allowed"
Case eventinfo.vchar() = "VK_F8":
DisAbleDeFault
msgstop("Error","Action Not Allowed"
Case eventinfo.vchar() = "VK_F9":
DisAbleDeFault
msgstop("Error","Action Not Allowed"
EndSwitch
endif
if GetNetUserName() = "rcmyers" or GetNetUserName() = "acmulfor" then
else
Switch
Case Eventinfo.isControlKeyDown() and eventinfo.vchar() = "VK_F4" :
DisableDefault
msgstop("Error","Action Not Allowed"
Case eventInfo.isAltKeyDown() and eventinfo.vchar() = "VK_F4":
disabledefault
msgstop("Error","Action Not Allowed"
Case eventInfo.isAltKeyDown() and eventinfo.vchar() = "VK_CANCEL":
disabledefault
msgstop("Error","Action Not Allowed"

Case eventInfo.isControlKeyDown() and eventinfo.vchar() = "VK_CANCEL":
disabledefault
msgstop("Error","Action Not Allowed"
Case eventInfo.isAltKeyDown() and eventinfo.vchar() = "VK_PAUSE":
disabledefault
msgstop("Error","Action Not Allowed"
Case eventInfo.isControlKeyDown() and eventinfo.vchar() = "VK_PAUSE":
disabledefault
msgstop("Error","Action Not Allowed"

EndSwitch
endif
endif
Events - MenuAction
Var
Mycaller Form
evid SmallInt
ix, iy, ih, iw,
ox, oy, oh, ow,
newHeight,
newWidth LongInt
EndVar
if eventInfo.isPreFilter() then
else
evid = eventinfo.id()
Switch
case evId = MenuControlSize:
thisForm.GetPosition(ox,oy,ow,oh)
dodefault
thisform.setposition(ix,iy,iw,ih)
if iw <> ow then
Newheight = Longint( number(iw) / aspRatio )
thisform.setposition(ix,iy,iw,newheight)
else
newwidth = LongInt( number(ih)*aspRatio )
thisform.setposition(ix,iy,newwidth,ih)
endif
case evid = MenuWindowCascade:
dodefault
thisform.getposition(ix,iy,iw,ih)
if aspRatio < ( number(iw) / number(ih) ) then
Nwewidth = Longint( number(ih) * aspratio )
thisform.setposition(ix,iy,newwidth,ih)
endif
endswitch
endIf
if eventInfo.id() = MenuControlSize then
eventInfo.setErrorCode(UserError)
endIf
if eventInfo.id() = MenuControlMinimize then
eventInfo.setErrorCode(UserError)
maximize()
endIf
if eventInfo.id() = MenuControlClose then
disabledefault
eventInfo.setErrorCode(UserError)
endIf
if eventInfo.id() = MenuControlMove then
eventInfo.setErrorCode(UserError)
endIf
if eventInfo.id() = MenuControlMouseMenu then
disableDefault
eventInfo.setErrorCode(UserError)
endIf
if eventInfo.id() = MenuControlNextwindow then
disableDefault
eventInfo.setErrorCode(UserError)
endIf