根据显示器分辨率设置窗口显示位置

根据显示器分辨率设置窗口显示位置,第1张

根据显示器分辨率设置窗口显示位置,第2张

函数名: change_systemmetrics
  Written by Vial.Z
  参数:
w_1 窗口变量
作用:
根据显示器分辨率设置窗口显示位置
调用方法:
在窗口的Open事件中,输入代码change_systemmetrics(this),
如果窗口是继承的,请注意调用的位置。(在父窗口的open调用
可能失效)
-----------------------------------------------------*/
integer li_1024bc = 50 /*1024分辨率下的编差值*/
integer li_800bc = 50 /*800分辨率下的编差值*/

Integer li_WS_Width /*工作区宽度*/
Integer li_WS_Height /*工作区高度*/
Integer li_my_Width /*当前窗口宽度*/
Integer li_my_Height /*当前窗口高度*/

integer li_system_metrics /*系统分辨率*/

/*w_main是MDI中的主窗口,这里取得其客户显示区的大小(做了适当调整)*/
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 /* 640×480 下所有窗口有化*/
w_1.WindowState = maximized!
case 800 /* 800×600*/
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 /* 1024×768 ...*/
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

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 根据显示器分辨率设置窗口显示位置

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情