Why is a maximized Delphi form 8 pixels wider and higher than the GetSystemMetrics values?

前端 未结 2 1646
萌比男神i
萌比男神i 2020-12-11 16:16

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

For Example

相关标签:
2条回答
  • 2020-12-11 17:04

    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.

    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, as usual, has an article that covers the details: Why does a maximized window have the wrong window rectangle?

    0 讨论(0)
  • 2020-12-11 17:05

    I wrote simple program, which catches WM_GETMINMAXINFO. This message allows one to modify position and size of maximized window, before the actual maximization takes place. The default values provided by system were:

    Position.x: -8
    Position.y: -8
    Size.x: 1456 (= 8 + width of screen + 8)
    Size.y: 916 (= 8 + height of screen + 8)
    

    The resolution of my screen is 1440x900.

    It seems, that Windows positions the window after the maximization in such way, that the client area covers the most the available space and window's chrome is hidden outside the screen area.

    0 讨论(0)
提交回复
热议问题