JM:I have a dream,期待和你一起去实现!
原文及译文
JM
网友:tbone

        由于Access 2003不具备2007年存在的控件锚定功能,因此我想知道是否有人或已经知道可以提供此功能的某些VBA脚本或免费软件控件?...

推荐:想去Google查资料?(你懂的)想建站?想测试?想挂机?想折腾?想要高性价比的服务器?点我!!


VBA脚本自动调整MS Access 2003窗体中的控件/子窗体?(VBA script for auto resizing of controls/subforms in MS Access 2003 forms?)

由于Access 2003不具备2007年存在的控件锚定功能,因此我想知道是否有人或已经知道可以提供此功能的某些VBA脚本或免费软件控件?


Since Access 2003 doesn't have the control anchoring functionality as exists in 2007, I was wondering if anyone has or is aware of some VBA script, or a freeware control, that can give this functionality?


解决方案(由网友Godeke提供)

我知道在2003年没有确切的重复2007年的功能。有多个组件分辨率独立性(基于用户监视器分辨率调整窗体上的控件大小)和调整窗体大小事件(如http:// www .fmsinc.com /产品/组件/ ControlTour / resize.htm)。没有,我知道2007年的经验是完全相同的,但是可以在这里找到类似的问题(和代码来处理它):http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23662850.html

就我个人而言,我只是自己处理了调整大小事件。最简单的方法就是创建一个你希望支持的最小尺寸的表单,然后记录基本位置和宽度(无论是在表格中,还是在表格范围内的常量)。从那里你可以调整使用:

resizeRatio = currentFormWidth / baseFormWidth

control.left = baseLeft * resizeRatio
control.width = baseWidth * resizeRatio

你自己做这件事的好处是,随着时间的推移,你会发展它,例如保持左侧标签的宽度相同,但向右扩展字段(这是通过根本不调整标签大小来完成的)在应用位置和宽度变化之前,标签区域的结束距离表格的宽度,例如:

resizeRatio = (currentFormWidth - labelsAreaWidth) / (baseFormWidth - labelsAreaWidth)

control.left = (baseLeft - labelsAreaWidth) * resizeRatio + labelsAreaWidth
control.width = baseWidth * resizeRatio 

I know of no exact duplication of the 2007 functionality in 2003. There are multiple components for resolution independence (resizing the controls on a form based on the users monitor resolution) and for resizing with the form resize event (such as http://www.fmsinc.com/products/components/ControlTour/resize.htm). None that I'm aware of quite replicate the 2007 experience, but a similar question (and code to handle it) can be found here: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23662850.html

Personally, I just handled the resize event myself. The easiest way is to do so is to create the form in the minimum size you wish to support, and then record the base positions and widths (either in a table or as form scoped constants). From there you can resize using:

resizeRatio = currentFormWidth / baseFormWidth

control.left = baseLeft * resizeRatio
control.width = baseWidth * resizeRatio

The advantage to doing this yourself is that over time you evolve it, with things such as keeping the labels on the left side the same width but expanding the fields to the right (this is done by not resizing the labels at all, and subtracting the end of the labels area off from the width of the form before applying the position and width changes, such as):

resizeRatio = (currentFormWidth - labelsAreaWidth) / (baseFormWidth - labelsAreaWidth)

control.left = (baseLeft - labelsAreaWidth) * resizeRatio + labelsAreaWidth
control.width = baseWidth * resizeRatio 

推荐:想去Google查资料?(你懂的)想建站?想测试?想挂机?想折腾?想要高性价比的服务器?点我!!


关于站长

JMJavaMethod的缩写,苦逼码农一个,一直想有番作为,奈何人老力衰,只能四处膜拜大佬以获得动力。已经从单机、局域网、互联网、混到了移动互联网,未来希望能在AI世界里继续混下去。这辈子有个终极目标:财务自由,心灵自由。

近期公告

一个人苦逼开发多日,网站终于正式上线,求关注!!! 一个人苦逼多日,终于正式上线,求关注!!!

找他  
猜你喜欢
想建站?想测试?
想挂机?想折腾?
想去Google查资料?(你懂的)
想要高性价比的服务器?
搬瓦工VPS - 性价最高的美国便宜VPS主机
友情链接

冀ICP备17016304号 版权所有 © JavaMethod.com All Rights Reserved,Theme by 拼图