根據顯示器分辨率設置窗口顯示位置
函數名: change_systemmetrics
Written by Vial.Z
蓡數:
w_1 窗口變量
作用:
根據顯示器分辨率設置窗口顯示位置
調用方法:
在窗口的Open事件中,輸入代碼change_systemmetrics(this),
如果窗口是繼承的,請注意調用的位置。(在父窗口的open調用
可能失傚)
-----------------------------------------------------*/
integer li_1024bc = 50
integer li_800bc = 50
Integer li_WS_Width
Integer li_WS_Height
Integer li_my_Width
Integer li_my_Height
integer li_system_metrics
li_WS_Width = w_main.WorkSpaceWidth() -8
li_WS_Height = w_main.WorkSpaceHeight() - w_main.dw_statebar.height -8
li_my_Width = w_1.Width
li_my_Height = w_1.Height
li_system_metrics = getsystemmetrics(0)
choose case li_system_metrics
case 640
w_1.WindowState = maximized!
case 800
if li_my_Width li_800bc >= li_WS_Width or li_my_Height li_800bc >= li_WS_Height then
w_1.WindowState = maximized!
else
w_1.WindowState = normal!
w_1.X = ( li_WS_Width - li_my_Width) /2
w_1.Y = (li_WS_Height - li_my_Height ) /2
end if
case else
if li_my_Width li_1024bc >= li_WS_Width or li_my_Height li_1024bc >= li_WS_Height then
w_1.WindowState = maximized!
else
w_1.WindowState = normal!
w_1.X = ( li_WS_Width - li_my_Width) /2
w_1.Y = (li_WS_Height - li_my_Height ) /2
end if
end choose
0條評論