Windows 窗体调整大小
我在 Visual Studio 2010 中创建了一个表单,并将其大小属性设置为 1280x800。我希望它的内容(四个图片框)完全填充这个屏幕分辨率。当我更改分辨率(从 1920x1080 到 1280x800)进行测试时,它在我的开发计算机上运行良好,但当我在客户端笔记本电脑上部署时,一切都会变得混乱。基本上它使所有控件变得更小。
两台计算机都运行 Windows 7。我不想调整任何内容的大小,我想要为所有内容指定的大小。
如何防止表单内容调整大小?为什么会发生这种情况?如何在我的生产 PC 中测试这种行为?
I have created a form in Visual Studio 2010 and set its size property to 1280x800. I want its contents (four pictureboxes) to fill exactly this screen resolution. It works fine in my development computer when I change the resolution (from 1920x1080 to 1280x800) to test, but when I deploy at the client's laptop it messes everything up. Basically it makes all the controls smaller.
Both computers run Windows 7. I do not want anything to resize, I want exactly the size I specify for everything.
How do I prevent the form contents from resizing? Why is this happening and how can I test for this behavior in my production PC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正是 DPI 设置将事情搞砸了。
It was the DPI setting that messed things up.
调整 Anchor 属性Picturebox 控件可正确固定到应用程序中的窗口。当您调整窗口大小时,这也会调整图片框的大小。
Adjust the Anchor property of the Picturebox controls to fix correctly to the window in your application. Which will resize the pictureboxes also when you resize the window.