自动调整屏幕大小
标签: 分辨率 自动 屏幕
2006-10-29 19:38 阅读(1294)评论(0)
-- 自动调整屏幕大小
*-- 函数 sysmetric(n)
*-- 参数含义及返回值
* 1 当前屏幕宽度
* 2 当前屏幕高度
*-- 如果当前屏幕的宽度不是预先在设计模式下设定的宽度,则进行对表单上控件的自动调整
*-- 注释: _DesignWidth 和 _DesignHeight 是人为设定的程序运行的默认窗口大小
IF SYSMETRIC(1) <> This._DesignWidth
#DEFINE nHeightFactor SYSMETRIC(2) / This._DesignHeight && 默认为 480
#DEFINE nWidthFactor SYSMETRIC(1) / This._DesignWidth && 默认为 640
WITH THIS
*-- 重新调整表单的大小和位置
.Width = .Width * nWidthFactor
.Height = .Height * nHeightFactor
.Left = .Left * nWidthFactor
.Top = .Top * nHeightFactor
*-- 重新调整表单上的控件的大小和位置
FOR nControlLoop = 1 TO .ControlCount
.Controls[nControlLoop].Width = .Controls[nControlLoop].Width * nWidthFactor
.Controls[nControlLoop].Height = .Controls[nControlLoop].Height * nHeightFactor
.Controls[nControlLoop].Left = .Controls[nControlLoop].Left * nWidthFactor
.Controls[nControlLoop].Top = .Controls[nControlLoop].Top * nHeightFactor
*-- 调整控件字体大小
IF PEMSTATUS(.Controls[nControlLoop],"FontSize",5)
.Controls[nControlLoop].FontSize = INT(.Controls[nControlLoop].FontSize * nHeightFactor)
ENDIF
ENDFOR
ENDWITH
ENDIF
将上述代码放在表单的INIT事件是有用的,若将This._DesignWidth改为640,将This._DesignHeight改为480,设AUTOCENTER=.f.效果非常明显
分享到:
本文来源:https://www.wddqw.com/doc/98eeb56e5a8102d276a22fe0.html
正在阅读:
vfp自动调整屏幕01-01
蹲踞式起跑教案01-01
72小时是几天01-01
南渡北归心得体会120001-01
采访我的大学生哥哥作文01-01
药师灌顶真言注音01-01
高中议论文范文800字:坚持就是胜利01-01
幼师教育随笔反思自己的行为01-01