为什么最大化的 Delphi 表单比 GetSystemMetrics 值宽和高 8 个像素? [英] Why is a maximized Delphi form 8 pixels wider and higher than the GetSystemMetrics values?

查看:13
本文介绍了为什么最大化的 Delphi 表单比 GetSystemMetrics 值宽和高 8 个像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我最大化 Delphi 表单的宽度和高度值比相应的 GetSystemMetrics SM_CXSCREEN 和 SM_CYSCREEN 大 8 个像素?

If I maximize a Delphi form the width and height values are 8 pixles greater that the corresponding GetSystemMetrics SM_CXSCREEN and SM_CYSCREEN?

例如:

当我右键单击屏幕并获取属性时,我的屏幕分辨率为 1680 X 1050.这些是从 GetSystemMetrics(SM_CXSCREEN) 和 GetSystemMetrics(SM_CYSCREEN) 返回的相同值.

When I right click on my screen and get properties I have a 1680 X 1050 screen resolution. Those are the same values returned from GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN).

当我在我的 Delphi 应用程序中最大化表单时,我得到 1688 的宽度和 1058 的高度.有 8 个像素的差异.造成这种差异的原因是什么?

When I maximize the form in my Delphi application I get a width of 1688 and a height of 1058. There is an 8 pixel difference. What causes this difference?

推荐答案

最初实现最大化窗口时,设计人员希望移除调整大小的边框.他们没有移除它们,而是决定将这些边框绘制在屏幕边缘之外,在那里它们不会被看到.因此,最大化窗口的窗口矩形相当令人惊讶.

When maximized windows were originally implemented, the designers wanted to remove the resizing borders. Rather than removing them, they instead decided to draw those borders beyond the edges of the screen, where they would not be seen. Hence the rather surprising window rectangle of a maximized window.

随着多显示器系统的出现,这个实施决定成为一个问题.到那时,有些应用程序依赖于这种行为,因此 Windows 团队为了兼容性决定保留这种行为.这意味着最大化的窗口会泄漏到相邻的屏幕上.随着时间的推移,窗口管理器获得了意味着它可以抑制这种泄漏的能力.

This implementation decision became a problem with the advent of multi-monitor systems. By that time there were applications that relied on this behaviour and so the Windows team decided to retain the behaviour for the sake of compatibility. This meant that maximized windows leaked onto neighbouring screens. In time the window manager acquired capabilities that meant it could suppress that leakage.

Raymond Chen 像往常一样,有一篇文章介绍了详细信息:为什么最大化的窗口有错误的窗口矩形?

Raymond Chen, as usual, has an article that covers the details: Why does a maximized window have the wrong window rectangle?

这篇关于为什么最大化的 Delphi 表单比 GetSystemMetrics 值宽和高 8 个像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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