为什么 Windows 窗体在不同的计算机上调整大小
我有一个表单,其大小已调整为我想要的大小,它上面有一些面板、一些按钮和一些标签,但是当我在另一台计算机上打开它时,它会调整大小并且更大。我正在使用 Visual Studio 2008。我知道这只是很少的细节,但我想也许有人知道一个已知问题或我可以采取的一些故障排除步骤。
I have a form that I have sized to what I wanted, it has a few panels, some buttons and some labels on it but when I open it on a different computer, it is resized and it is larger. I am using visual studio 2008. I know this is very little detail but I thought maybe someone knows of a known issue or some troubleshooting steps that I can take.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
造成这种情况的可能原因是不同的屏幕分辨率和不同的 DPI。
Possible reasons for this are different screen resolution and different DPI.
几个可能的原因。首先也是最重要的是表单的 AutoScaleMode 属性。默认值“字体”可确保调整字体和控件的大小,以便为任何显示的文本留出足够的空间。文本大小以磅为单位,即 1/72 英寸。如果您在视频适配器的每英寸点数设置较大的计算机上运行程序,则字体会相应增大并需要更多像素。这也需要更大的控件以防止剪切文本。
另一个原因是用户对边框宽度 (Aero) 和标题栏高度的偏好。表单的大小基于其设计的 ClientSize,运行时的实际大小将通过将这些首选项添加到设计大小来确定。这很少是一个问题。
Several possible reasons. First and foremost is the form's AutoScaleMode property. The default, Font, ensures that both the font and the controls get resized to leave enough room for any displayed text. Text size is measured in points, 1/72 of an inch. If you run your program on a machine with a larger dots-per-inch setting for the video adapter, the fonts grow accordingly and need more pixels. That needs the controls to be bigger as well to prevent clipping the text.
Another reason is user preferences for border width (Aero) and caption bar height. A form is sized based on its designed ClientSize, the actual Size at runtime will be determined by adding those preferences to the design size. That's very rarely a problem.
可能是计算机的屏幕分辨率不同,这就是为什么它在一台计算机上显示小而在另一台计算机上显示大的原因
May be the computers have different screen resolution and that's why it appears small in one and large on the other computer
不同的分辨率,不同的浏览器,不同的版本。如果您想防止这种情况发生,则必须指定它们的宽度和高度。
Diffeent resolutions, different browsers, different versions. If you want o keep this from happening, you must specify their width and height.