Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Centering a Window on Your Desktop (Functions/Subroutines/Programs) ====== ====== ====== ==== Created at 12 FEB 1998 09:33AM ==== The following code is to center a form on your desktop. subroutine CenterWindow (void) Declare Function Get_Property Declare Subroutine Set_Property %%**%% Get the size of the system (Resolution) sysRes = Get_Property("SYSTEM" , "SIZE") sysWidth = sysRes<3> sysHeigth = sysRes<4> %%**%% Get the size of the window to center winSize = Get_Property(@WINDOW , "SIZE" ) winWidth = winSize<3> winHeight = winSize<4> %%**%% Get the coordinates for the new window. (The window should be first set to not visible) winOffsetFromTop = (sysHeight - winHeight) / 2 winOffsetFromLeft = (sysWidth - winWidth) / 2 %%**%% Set the size of the window which will also make the form visible Set_Property( @WINDOW , "SIZE" , winOffsetFromLeft:@FM:winOffsetFromTop:@FM:winWidth:@FM:winHeight) return kb/kb_articles/kb0142.txt Last modified: 2024/01/30 13:36by 127.0.0.1