窗口大小显示为大于我的屏幕分辨率? [英] Window size displayed as bigger than my screen resolution?

查看:447
本文介绍了窗口大小显示为大于我的屏幕分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我已完成以下操作(按一下按钮):



Hi,

I''ve done the following (on a button click):

int width = Form1::Width::get();
int height = Form1::Height::get();

this->textBox1->Text = Convert::ToString( width );
this->textBox2->Text = Convert::ToString ( height );





我的屏幕分辨率为1440乘900,但文本框的分辨率为1446 x 876.



我只是好奇为什么这是?



My screen resolution is 1440 by 900, but the textboxes give it as 1446 x 876.

I was just curious why this is?

推荐答案

在表单/窗口设计中使用绝对大小和位置的整个方法是错误的。您可以轻松开发流体设计,使其适应屏幕尺寸。我在过去的答案中解释过:

当屏幕分辨率发生变化时Zom Out出现故障 [ ^ ],

如何停靠按钮,以便它可以用表格调整 [ ^ ]。< br $>






解决方案2中的最大化解释是正确的,但你也应该采取考虑到窗口在没有系统托盘的区域中最大化。另请参阅我对解决方案2的评论。



-SA
The whole approach of using absolute sizes and positions in the form/window design is wrong. You can easily develop a fluid design to make it tolerant to screen size. I explained it in my past answers:
Zom Out malfunctions when Screen resolution changes[^],
how to dock button so that it can adjust with the form[^].



The explanation of maximization give in Solution 2 is correct, but you also should take into account that the window is maximized in the area free from the system tray. See also my comments to Solution 2.

—SA


是的,这是一个有趣的观察。您可能在使用其大小之前最大化了Form1。现在,Windows在最大化框架窗口时所做的是:它增加了它的大小,使得窗口框架落在屏幕区域之外。因此,视觉上框架消失。然而,在幕后,窗口从一些负面位置开始,并且略大于屏幕。这解释了你的观察结果。



回答你的其他问题:



你可以找回通过使用参数SPI_GETWORKAREA调用SystemParametersInfo来调用所谓的工作区的大小。请参阅 SystemParametersInfo [ ^ ] 。
Yes, that is an interesting observation. You have probably maximized your Form1 before you took its size. Now, what Windows does when it maximizes a frame window is: It increases its size such that the window frame falls outside the screen area. Hence visually the frame disappears. Behind the scenes, however, the window starts at some negative position and is slightly larger than the screen. That explains your observation.

Answer to your additional question:

You can retrieve the size of the so-called workarea by calling SystemParametersInfo with argument SPI_GETWORKAREA. See SystemParametersInfo[^].


您应该使用 GetSystemMetrics 功能 [ ^ ]。


这篇关于窗口大小显示为大于我的屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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