使用VBA保存标签和文本属性 [英] Save label and text properties with VBA

查看:142
本文介绍了使用VBA保存标签和文本属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表格"testform"中有几个标签和文本框,我喜欢根据客户的显示器大小进行调整。 


我想调整的例子是文本框的宽度"txt_testbox"。在设计模式中这样做很容易。只需打开属性窗口即可。我怎么能用VBA做到这一点?在属性窗口中,width = 50。现在我想将其更改为100. 
如果我使用txt_textbox.width = 100,文本框宽度确实会变为100.但是如果我再次打开表单原始宽度= 50。因此,100不会永久存储在属性列表中。我怎么能这样做。


Jantje

解决方案


所以100不会永久存储在属性列表中。我怎么能这样做。


嗨Jantje,


要永久地改变控件的宽度,你可以在表单的设计模式中执行此操作。


要动态更改宽度,可以在窗体的Open或Load事件中使用某些代码。您可以使用窗体的OpenArgs属性将监视器大小传递给窗体。然后在Open或Load事件中,您可以根据OpenArgs中的值调整控件(或全部)
的宽度。


这是一个有趣的区域,您输入这样。



Imb。




In my form "testform" there are several labels and textboxes, which I like to adjust dependent on clients monitor size. 

I would like to adjust for instance is the width of the textbox "txt_testbox". To do that in design mode is easy. Just open the property window. How can I do that with VBA? In the property window the width =50. Now I like to change that to 100.  If I use txt_textbox.width=100, the textbox width will indeed become 100. However if I open the form again the original width = 50 again. So the 100 is not stored in the property listing permanently. How can I do that.

Jantje

解决方案

So the 100 is not stored in the property listing permanently. How can I do that.

Hi Jantje,

To change the width of a control permanently, you can do that in design mode of the form.

To change the width dynamically, you can use some code in the Open or Load event of the form. You could pass the monitor size to the form using the OpenArgs property of the form. Then in the Open or Load event you can adjust the width of a control (or all) depending on the value in OpenArgs.

It is an interesting area that you enter in this way.

Imb.


这篇关于使用VBA保存标签和文本属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆