vba Ms-Access 中的自动调整表单和内容大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16054703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 20:38:50  来源:igfitidea点击:

Auto-Resize Form and Contents in Ms-Access

vbams-accessaccess-vbascreen-resolutionms-access-2000

提问by Justin

Background:

背景:

I am creating an application in Ms-Access that is to be launched on a multi-user platform - This means many screens and many different resolutions etc.

我正在 Ms-Access 中创建一个将在多用户平台上启动的应用程序 - 这意味着许多屏幕和许多不同的分辨率等。

Question:

题:

Is it possible to have my application that automatically adjusts to the right size of the screen/resolution and the font size to be proportional to that of the % increased or decreased?

是否可以让我的应用程序自动调整到屏幕/分辨率的正确大小,并且字体大小与增加或减少的百分比成正比?

采纳答案by Gord Thompson

Similar to my answer here, yes, you can use the On Resizeevent of a form to move controls around, change the size of subforms, and perform other similar operations. Those adjustments are applied to each individual object, so the coding would be somewhat tedious and a bit "fussy", but it can be done (at least to some extent).

类似于我在这里的回答,是的,您可以使用On Resize表单的事件来移动控件、更改子表单的大小以及执行其他类似的操作。这些调整应用于每个单独的对象,因此编码会有些乏味且有点“繁琐”,但可以完成(至少在某种程度上)。

回答by Dan Metheus

The font size will not automatically change based on screen resolution in any version of Access, but starting with Microsoft Access 2007you can use new properties of controls to make them stretch, shrink or movebased on the size of a form (described here)

在任何版本的 Access 中,字体大小都不会根据屏幕分辨率自动更改,但从Microsoft Access 2007开始,您可以使用控件的新属性使它们根据表单的大小进行拉伸、收缩或移动此处描述)

回答by Dan Metheus

Try using the VBA code in thisanswer to see if it gives you what you want. It works basically the way that Gord Thompson recommended. When the form is resized, all the controls and the text on the form will be proportionally resized too so that it looks the same no matter what size the window is, or what the user has their monitor resolution set to.

尝试使用答案中的 VBA 代码,看看它是否能满足您的需求。它基本上按照戈德汤普森推荐的方式工作。调整窗体大小时,窗体上的所有控件和文本也将按比例调整大小,以便无论窗口大小或用户将显示器分辨率设置为多少,它看起来都相同。