控件在构建时以 vs2008 设计模式移动 [英] Controls moving in vs2008 design mode on build

查看:25
本文介绍了控件在构建时以 vs2008 设计模式移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C#.NET winforms 项目,每当我构建该项目时,一些控件都会在设计视图中移动.它仅有的一些控件(一个带有标签和数据网格视图的面板、一个按钮、一个链接按钮和一个标签)在每次构建时都在向上移动.

I have a C#.NET winforms project, and some controls are moving in design view whenever I build the project. Its only some of the controls (a panel with a label and datagridview in it, a button, a link button and a label) are all moving up on each build.

有没有人见过这个或知道如何解决它?

Has anyone seen this before or know how to fix it?

推荐答案

我认为是因为 AutoScaleDimensions.我的猜测是您的表单最初是在另一台机器上创建的.

I think it is because of the AutoScaleDimensions. My guess is that your form was originally created on another machine.

每个 MSDN.

"AutoScaleDimensions 属性表示 DPI 或字体设置控件缩放到或设计用于的屏幕.具体来说,在设计时此属性将由 Windows 设置将设计器设计为您的显示器当前使用的值.然后,当窗体在运行时加载时,如果 CurrentAutoScaleDimensions属性不同于 AutoScaleDimensions,将调用 PerformAutoScale 方法来执行缩放control 及其所有子项.之后,AutoScaleDimensions 将进行更新以反映新的缩放大小."

"The AutoScaleDimensions property represents the DPI or font setting of the screen that the control was scaled to or designed for. Specifically, at design time this property will be set by the Windows Forms designer to the value your monitor is currently using. Then, when the form loads at run time, if the CurrentAutoScaleDimensions property is different from the AutoScaleDimensions, the PerformAutoScale method will be called to perform scaling of the control and all of its children. Afterwards, AutoScaleDimensions will be updated to reflect the new scaling size."

我的猜测是,出于某种奇怪的原因,当您构建项目属性(可能是其他一些属性)时,会进行调整,但不会在设计时进行调整.我想了几个可能的原因:

My guess is that for odd some reason when you build you project property (maybe some others) gets adjusted, but not on design time. I think about few possible reasons:

  • 你在多台显示器上工作和/或你的适配器有一些奇怪的东西.

  • You work on multiple monitors and/or there is some odd stuff with your adapter.

自动生成的设计器文件存在一些问题.也许吧
以某种方式手动编辑.

There is some problem with auto-generated designer file. Maybe it
edited manually somehow.

为了解决问题,我建议做一些我会做的事情:

To fix I propose to do something I would do:

  • 如果可能,通过复制粘贴位从头开始重新创建表单一个一个.

  • Recreate form from scratch if possible, by copy-pasting bits one-by-one.

如果不采取一些合并工具并插入新表格属性.

If not take some merging tool and insert fresh form properties.

还有一个关于的有趣问题自动缩放尺寸.

这篇关于控件在构建时以 vs2008 设计模式移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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