您现在的位置是: IT外包 ->技术支持 ->基础知识 ->
 
本文关键字: 分辨率
Google
 
根据显示器分辨率设置窗口显示位置
作者: 不详 | 发布时间: 2008-07-14 13:26 | 信息类别: 基础知识 | 访问人次:
评论 推荐 打印 编辑 】 【 关闭
  

  
函数名: 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
评论 推荐 打印 编辑 】 【 关闭
『相关链接』
序号
标题 发布日期
1
2008-06-11 19:46:46
2
2008-06-11 14:21:39
3
2007-11-16 14:38:00
4
2007-05-29 18:18:47
5
2007-04-09 04:00:44
6
2007-04-06 14:25:41
7
2007-04-06 12:34:24
8
2007-04-06 10:26:26
9
2007-04-06 09:23:32
10
2007-03-01 12:33:55
    查看所有相关的信息...
【郑重声明】【上海IT外包服务网】 刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何投资或其他建议。转载需经作者本人同意并注明出处。本网站有部分文章是由网友自由上传。对于此类文章本站仅提供交流平台,不为其版权负责。如果您发现本网站上有侵犯您的知识产权的文章,请发信至 或直接电话联系: 021-58879030
请您留言
『发表评论』
匿名发表 会员ID: 密码:

上海蝶应信息科技有限公司
上海市商城路341号紫光大厦1305室 +0086-21-58878998 11394019
dieying@541help.com +0086-21-58879030HappyFreeAngel@hotmail.com
Copyright@2007 IT-WAIBAO.COM Inc.沪ICP备05039378号 版权所有2007-2010 管理员登陆