在运行时构建的缩放控件 [英] Scaling Controls built at Runtime

查看:145
本文介绍了在运行时构建的缩放控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在设计时将控件添加到掌上电脑表格时,所有缩放工作都很好 - 我在初始化代码中看到使用AutoScaleDeminsions和AutoScaleMode。

但是,当我在运行时动态添加一个控件(比如一个按钮)而且我使用AutoScaleDeminsions和AutoScaleMode作为父表单时,它不起作用而且我得到一个严重缩放按钮。

我可以使用button.Scale(x)并获得控制以进行缩放。

在运行时添加的缩放控件的首选方法是什么?
Thx

推荐答案

我在这里遇到类似的船。

我们正在将我们的应用程序从CF1升级到CF3.5,并注意到在更高分辨率的设备上,一切都是应有的一半。

当然,我们已将AutoScaleMode设置为所有表格的DPI这几乎解决了所有问题。

然而,从CF1移植的用户控制仍然是更高分辨率的预期尺寸的一半
我知道我可以更改用户控制代码设置自动缩放属性,这将自动将控件缩放到正确的大小。

我想知道的是:这是用于将用户控件从CF1更新到CF3.5的Microsoft推荐程序吗?或者我们应该采取其他方式吗?

I am in a similar boat here.

We're upgrading our app from CF1 to CF3.5 and noticing that on higher resolution devices, everything is half the size it should be.

Naturally, we have set the AutoScaleMode to DPI for all forms and this has fixed almost everything.

However, user controls ported from CF1 are still half their expected size on a higher resolution

I understand that I can change the user control code to set the autoscale property and this will automatically scale the control to the right size.

All I want to know is: Is this the Microsoft Recommended Procedure for updating user controls from CF1 to CF3.5?  Or is there some other way we should be doing this?


这篇关于在运行时构建的缩放控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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