设计师中的表单大小不等于运行时的大小 [英] Size of form in designer not equal to size when run

查看:71
本文介绍了设计师中的表单大小不等于运行时的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Visual Studio Community 2015一段时间没有问题。但是,在切换到具有更高分辨率(3840x2160)的新计算机后,我的Visual C#Windows窗体应用程序出现了一个奇怪的问题。


将解决方案迁移到我的新计算机后,所有内容都已构建,跑得很好。但是当我在设计师中重新调整表格大小时,跑步后突然大小不匹配。按钮,文本框和其他组件的大小都很好,但
整个窗口的大小不是。将分辨率更改为1280x720无效。 Form.Designer.cs中的数字会相应更新。


我用一个新项目重现了这个,所以我很确定我的旧解决方案中的代码都没有涉及到这里。视频在这里:https://www.youtube.com/watch?v = 2DIXGfymrqw& feature = youroutu.be(在我的帐户经过验证之前我无法提交链接,但是
它没有说明我怎么验证它,嗯......)有没有人遇到过这个?我该怎么办才能修复它?谢谢。

解决方案

嗨德文,<​​/ p>

因为我身边的分辨率并不高,现在我不能在我身边重复它。


如果我在Form1属性中将 AutoSize 更改为" True ",我有尺寸问题,但"错误"很好(分辨率为1600 * 900)。这可能不是造成这个问题的主要原因。


但是,我找到 AutoScaleMode ,您可以将其更改为
Dpi
进行检查。






最重要的是,


Fletch


Hi, I've been using Visual Studio Community 2015 for a while with no problem. However, after switching to a new computer with higher resolution (3840x2160) a strange problem has occurred with my Visual C# Windows Forms Applications.

After migrating a solution to my new machine, everything built and ran fine. But when I resized a form in the designer, suddenly the size did not match after running. The sizes of the buttons, text boxes, and other components were fine, but the size of the whole window was not. Changing resolution to 1280x720 had no effect. The numbers in Form.Designer.cs do update appropriately.

I reproduced this with a new project, so I'm pretty sure none of the code from my old solution is involved here. The video is here: https://www.youtube.com/watch?v=2DIXGfymrqw&feature=youtu.be (I can't submit a link until my account is verified, but it doesn't tell me how to verify it, hmm...) Has anyone encountered this before? What can I do to fix it? Thanks.

解决方案

Hi Devon,

As the resolution in my side is not that high, for now I could not repro it in my side.

If I change the AutoSize to "True" in Form1 properties, I had the size issue, but "False" is fine (the resolution is 1600*900). It’s probably not the main reason to cause this issue in your side.

But, I found the AutoScaleMode, you could change it to Dpi to have a check.

Best regard,

Fletch


这篇关于设计师中的表单大小不等于运行时的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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